labels | R Documentation |
Assign labels to a vector or data.frame.
assign_labels(x, ...)
## Default S3 method:
assign_labels(x, label, ...)
## S3 method for class 'data.frame'
assign_labels(
x,
...,
.missing = c("error", "warn", "skip"),
.ls = rlang::list2(...)
)
get_labels(x)
## Default S3 method:
get_labels(x)
## S3 method for class 'data.frame'
get_labels(x)
view_labels(x, title)
remove_labels(x, ...)
## Default S3 method:
remove_labels(x, ...)
## S3 method for class 'data.frame'
remove_labels(x, cols, ...)
x |
A vector of data.frame |
... |
One or more unquoted expressed separated by commas. If assigning
to a data.frame, |
label |
A single length string of a label to be assigned |
.missing |
A control setting for dealing missing columns in a list;
can be set to |
.ls |
A named list of columns and labels to be set if |
title |
Title for the viewer window – if not supplemented will show as
|
cols |
A character vector of column names; if missing will remove the label attribute across all columns |
When labels are assigned to a data.frame they can make viewing the object
(with View()
inside Rstudio). The view_labels()
has a call to View()
inside and will retrieve the labels and show them in the viewer as a
data.frame.
A labelled vector or data.frame
labs <- assign_labels(
iris,
Sepal.Length = "cms",
Sepal.Width = "cms",
Petal.Length = "cms",
Petal.Width = "cms",
Species = "Iris ..."
)
labs$dummy <- ""
get_labels(labs) # shows label as <NA> for dummy column
labs0 <- remove_labels(labs, c("Sepal.Length", "Sepal.Width"))
get_labels(labs0) # No labels for Sepal.Length and Sepal.Width
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.