powered by
re_code
re_code re_code search for matches to argument pattern within each element of a character vector:
re_code(x, codes)
Variable to recode.
A data.frame of original value & recode value
# NOT RUN { SEX = sample(c("F","M"),1000,replace = TRUE) codes= data.frame(ori_value = c('F','M'), code = c(0,1) ) SEX_re = re_code(SEX,codes) # }
Run the code above in your browser using DataLab