#import the labels from a data.frame to another
iris_label = data.frame(
name=c("Sepal.Length", "Sepal.Width",
"Petal.Length", "Petal.Width", "Species"),
label=c("Length of Sepals", "Width of Sepals",
"Length of Petals", "Width of Petals", "Specie name")
)
iris %>%
import_labels(iris_label) %>%
crosstable
#save the labels, use some dplyr label-removing function, then retrieve the labels
library(dplyr)
mtcars2 %>%
save_labels() %>%
transmute(disp=as.numeric(disp)+1) %>%
import_labels(warn_label=FALSE) %>% #
crosstable(disp)
Run the code above in your browser using DataLab