label | R Documentation |
This function manipulates labels. It supports different classes of objects, including default objects, data frames, and other types.
label(x, label = NULL)
x |
The object to which the label will be added or modified. |
label |
A character string specifying the label to be assigned to the variable. |
When used with dplyr
's [mutate]
function,
this function allows for easy labeling of variables within a data frame.
If used with a data frame, the function labels the dataset itself, and
the label can be checked using the [codebook]
function.
The modified object with the updated label.
library(dplyr)
iris |>
mutate(Species = label(Species, 'Species of iris flower')) |>
codebook()
iris |>
label("Iris dataset") |>
codebook()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.