Skip to contents

Compare data (create new, deleted, and changed data)

Usage

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

Arguments

compare

comparison data table

base

base data table

by

join bs4Dash::column

by_col

new join bs4Dash::column name

cols

columns to compare

Value

list of comparison tables

Examples

# not run
m15 <- dfdiffs::master15
m22 <- dfdiffs::master22
compare_data(compare = m22, base = m15,
    by = "playerID",
    by_col = "join",
    cols = c("nameFirst", "nameLast", "nameGiven"))
#> $new_data
#> # A tibble: 1,595 × 4
#>    join      nameFirst nameLast nameGiven       
#>    <chr>     <chr>     <chr>    <chr>           
#>  1 abbotco01 Cory      Abbott   Cory James      
#>  2 abramcj01 C. J.     Abrams   Paul Christopher
#>  3 abreual01 Albert    Abreu    Albert Enmanuel 
#>  4 abreubr01 Bryan     Abreu    Bryan Enrique   
#>  5 acevedo01 Domingo   Acevedo  Domingo Antonio 
#>  6 acunaro01 Ronald    Acuna    Ronald Jose     
#>  7 adamewi01 Willy     Adames   Willy Rafael    
#>  8 adamja01  Jason     Adam     Jason Kendall   
#>  9 adamsau02 Austin    Adams    Austin Lance    
#> 10 adamsch01 Chance    Adams    Chance          
#> # … with 1,585 more rows
#> 
#> $deleted_data
#> # A tibble: 308 × 4
#>    join      nameFirst nameLast  nameGiven      
#>    <chr>     <chr>     <chr>     <chr>          
#>  1 adairji01 Jimmy     Adair     James Audrey   
#>  2 alvarju01 Juan      Alvarez   Juan M.        
#>  3 andrehu01 Hub       Andrews   Hubert         
#>  4 armstbo01 Robert    Armstrong Robert         
#>  5 atzja01   John      Atz       Jacob Henry    
#>  6 bakerfl01 Floyd     Baker     Floyd Wilson   
#>  7 barnema01 Matt      Barnes    Matthew D.     
#>  8 baronst01 Steve     Baron     Steven Phillip 
#>  9 bassich01 Chris     Bassitt   Christopher M. 
#> 10 beamal01  Alex      Beam      Alexander Roger
#> # … with 298 more rows
#> 
#> $changed_num_diffs
#> # A tibble: 3 × 2
#>   variable  no_of_differences
#>   <chr>                 <int>
#> 1 nameFirst                73
#> 2 nameLast                 19
#> 3 nameGiven               240
#> 
#> $changed_var_diffs
#> # A tibble: 332 × 4
#>    variable  join      base  compare 
#>    <chr>     <chr>     <chr> <chr>   
#>  1 nameFirst atzja01   John  Jake    
#>  2 nameFirst baronst01 Steve Steven  
#>  3 nameFirst breitte01 Ted   Theodore
#>  4 nameFirst brittza01 Zach  Zack    
#>  5 nameFirst brockle01 Lew   King    
#>  6 nameFirst cabreal01 Al    Alfredo 
#>  7 nameFirst carlle01  Lew   John    
#>  8 nameFirst carrodo01 Doc   Ralph   
#>  9 nameFirst chounch01 Chief Bill    
#> 10 nameFirst colgaed01 Ed    Billy   
#> # … with 322 more rows
#>