code_modify_recode {psHarmonize} | R Documentation |
Code modify recode. To be called by harmonization function.
Description
Code modify recode. To be called by harmonization function.
Usage
code_modify_recode(
data = temp_dataset,
instruction = code_instruct,
old_var = source_item_long,
new_var = item,
na_string = NULL
)
Arguments
data |
Dataframe to be modified |
instruction |
Coding instruction from harmonization sheet |
old_var |
Name of original variable |
new_var |
Name of new variable |
na_string |
Character string of final recode value to be set to NA. |
Value
Returns vector of new variable after recoding as needed.
Examples
test_data <- data.frame(val = c('a','b','c','d'))
code_modify_recode(data = test_data,
instruction = 'a = apple; c = carrot', old_var = 'val', new_var = 'new')
[Package psHarmonize version 0.3.5 Index]