I have a dataset called staffpai that i added variable labels to using expss's apply_labels() function. When i subset from that dataset, all labels disappear and I kind of would like to keep them. How do i either keep them, or what is another variable label function that i should use instead?
cc_limited <- subset(staffpai, close_code_cat=="Limited Service",
select=(-c(number, open_date, close_date, birth_date)))
Thanks
EDIT: Ok, i did this, and for some reason the labels came forward. ?? Originally, i applied the labels days ago, so when i subset, i didn't reapply library(expss) when i ran subset(), because why would i? I was done with labels. But apparently that is required???? Because below is an example of exactly what i did, but with mtcars and the labels come with it just fine. The only difference being, i hadn't shut down R in between. So i shut down R, and re-ran library(expss), and then re-ran the subset, without reapplying labels, and they came through just fine.
library(expss)
mtcars2 = apply_labels(mtcars,
mpg = "miles per gallon",
cyl = "cylinders",
hp = "horsepower")
mtcars3 <- subset(mtcars2, cyl=="6",
select=(-c(disp, drat, wt, qsec,
vs, am, gear, carb)))