Skip to contents

Create a table of new records

Usage

create_new_data(compare, base, by = NULL, by_col = NULL, cols = NULL)

Arguments

compare

a 'new' or 'current' dataset

base

an 'old' or 'previous' dataset

by

the joining bs4Dash::column between the two datasets

by_col

name of the new joining bs4Dash::column

cols

names of columns to compare

Value

new_data

Examples

# using local data
T2Data <- dfdiffs::T2Data
T1Data <- dfdiffs::T1Data
create_new_data(compare = T2Data, base = T1Data,
                by = c('subject', 'record'))
#> # A tibble: 3 × 8
#>   join  subject record start_date mid_date   end_date   text_var         facto…¹
#>   <chr> <chr>   <chr>  <chr>      <chr>      <chr>      <chr>            <chr>  
#> 1 D-5   D       5      2022-04-04 2022-04-13 2022-04-22 Four hours of s… associ…
#> 2 B-4   B       4      2022-04-02 2022-04-14 2022-04-20 The hogs were f… encour…
#> 3 A-2   A       2      2022-04-04 2022-04-15 2022-04-21 The box was thr… pension
#> # … with abbreviated variable name ¹​factor_var
create_new_data(compare = T2Data, base = T1Data,
                by = c('subject', 'record'),
                cols = c("text_var", "factor_var"))
#> # A tibble: 3 × 3
#>   join  text_var                                    factor_var
#>   <chr> <chr>                                       <chr>     
#> 1 D-5   Four hours of steady work faced us.         associate 
#> 2 B-4   The hogs were fed chopped corn and garbage. encourage 
#> 3 A-2   The box was thrown beside the parked truck. pension