
Last chance! 50% off unlimited learning
Sale ends in
strip_labs
removes all labelr meta-data attributes ("name.labs", "val.labs",
"frame.lab", and "factor.") from a data.frame, because you no longer want/need
it for some reason or another.
strip_labs(data)
a data.frame object with label attribute meta-data stripped from it.
a data.frame object.
Some labelr functions automatically use strip_labs
, but you should only
use it if you no longer want or need a given data.frame's labelr meta-data
(i.e., labels). If you have saved your labelr attributes (using
get_all_lab_atts
), you can restore them to the data.frame using
add_lab_atts
).
# make toy demographic (gender, raceth, etc.) data set
set.seed(555)
df <- make_demo_data(n = 1000) # another labelr:: function
# let's add variable VALUE labels for variable "raceth"
df <- add_val_labs(df,
vars = "raceth", vals = c(1:7),
labs = c("White", "Black", "Hispanic", "Asian", "AIAN", "Multi", "Other"),
max.unique.vals = 50
)
get_val_labs(df, "raceth") # it's here
df <- strip_labs(df) # this removes labs from df
get_val_labs(df, "raceth") # it's gone
check_any_lab_atts(df) # FALSE (means "no labs here")
Run the code above in your browser using DataLab