Post

Hi Shannon, do you have a post/thoughts on value labels? currently importing a 657-variable survey, and thinking about just using ordered factors with levels and labels. Also, thoughts on pros/cons of keeping integer values attached? e.g. 1_Yes, 2_No, 3_No_Answer 4_Dont_Know

last i worked with value labels ~3 years ago there wasn't much support in various pkgs for that object type, so was just easier for workflows to convert to factor.

0 reposts1 like

regarding coded integer values, it really depended on the wrangling/analysis objective. in pharma, it is standard to have two columns per response, one containing the coded integer value and one containing the text string.

Thanks. I may go with combo - as I can get the number back out with parse_number(), and the text string back out with str_extract(x, "(?<=\\d\\_).+") Plus, combo means I don't have to hunt in the codebook...

Custom tiny function to get string back out looks like: parse_string <- function(string) { str_extract(string = string, pattern = "(?<=\\d\\_).+") # to extract string portion from NN_StringValueLabel }