powered by
Possible values for categorical variables. To be called by harmonization function.
range_function_cat( data = temp_dataset, possible_vals_cat = possible_vals, new_var = item )
Returns a list with the new vector (values outside of set to NA), and the number of values set to NA.
data to be modified
vector of possible values
new variable
test_data <- data.frame(val = c('a','b','j','k','c','d')) range_function_cat(data = test_data, possible_vals_cat = c('a','b','c','d'), new_var = 'val')
Run the code above in your browser using DataLab