Last chance! 50% off unlimited learning
Sale ends in
Set the "label" attribute of an object
Copy the label from one variable to another
set_label(x, value, object = FALSE)copy_label_from(x, from)
the variable to label
value of the label. If x
is a list/data.frame, all the labels will be set recursively
if x
is a list/data.frame, object=TRUE
will force setting the labels of the object instead of the children
the variable whose label must be copied
An object of the same type as x
, with labels
An object of the same type as x
, with the label of from
# NOT RUN {
library(dplyr)
mtcars %>%
mutate(mpg2=set_label(mpg, "Miles per gallon"),
mpg3=mpg %>% copy_label_from(mpg2)) %>%
crosstable(c(mpg, mpg2, mpg3))
mtcars %>%
copy_label_from(mtcars2[,1:11]) %>%
crosstable(c(mpg, vs))
# }
Run the code above in your browser using DataLab