powered by
Code modify recode. To be called by harmonization function.
code_modify_recode( data = temp_dataset, instruction = code_instruct, old_var = source_item_long, new_var = item, na_string = NULL )
Returns vector of new variable after recoding as needed.
Dataframe to be modified
Coding instruction from harmonization sheet
Name of original variable
Name of new variable
Character string of final recode value to be set to NA.
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')
Run the code above in your browser using DataLab