This utility function updates the data set so variable names match those listed in the data dictionary.
Examples
data(ExampleM)
name_check(DD.dict.M, DS.data.M)
#> $Message
#> [1] "ERROR: the variable names DO NOT match between the data dictionary and the data. If the intention behind the variable names is correct, consider using the name_correct function to automatically rename variables to match."
#>
#> $Information
#> # A tibble: 2 × 2
#> Data Dict
#> <chr> <chr>
#> 1 Data: SMOKING_HX Dict: SMOKING_HISTORY
#> 2 Data: HX_DEPRESSION Dict: DEPRESSION_HX
#>
DS.data_updated <- name_correct(DD.dict.M, DS.data.M)
#> $Message
#> [1] "CORRECTED ERROR: the variable names differ between the data dictionary and the data. **ALERT** Renaming variable(s) to match those listed in the data dictionary."
#>
#> $Information
#> # A tibble: 2 × 3
#> Data Dict New.Data
#> <chr> <chr> <chr>
#> 1 Original data name: SMOKING_HX Dictionary name: SMOKING_HISTORY New data n…
#> 2 Original data name: HX_DEPRESSION Dictionary name: DEPRESSION_HX New data n…
#>
name_check(DD.dict.M, DS.data_updated)
#> $Message
#> [1] "Passed: the variable names match between the data dictionary and the data."
#>
#> $Information
#> [1] "Variable names matched"
#>