Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

labels

Labels


Description

Assign and extract the 'label' attribute on an R object. set_labels is the same as labels(x) <- value but returns x for use in a pipe chain. set_attr is the same as attr(x, which) <- value but returns x for use in a pipe chain.

Usage

## S3 method for class 'data.frame'
labels(object, ...)

## S3 method for class 'keep_labels'
labels(object, ...)

labels(x) <- value

## S3 replacement method for class 'keep_labels'
labels(x) <- value

## Default S3 replacement method:
labels(x) <- value

## S3 replacement method for class 'data.frame'
labels(x) <- value

set_labels(x, value)

set_attr(x, which, value)

Arguments

...

Other arguments (not in use at this time).

x, object

An R object.

value

A vector or list containing labels to assign. Labels are assigned based on names, if available; otherwise, they're assigned in order. Can pass NULL to remove all labels.

which

See attr<-

Details

The data.frame methods put labels on and extract labels from the columns of object.

Value

The labels of object, or object with new labels.

Author(s)

Ethan Heinzen

See Also


arsenal

An Arsenal of 'R' Functions for Large-Scale Statistical Summaries

v3.6.2
GPL (>= 2)
Authors
Ethan Heinzen [aut, cre], Jason Sinnwell [aut], Elizabeth Atkinson [aut], Tina Gunderson [aut], Gregory Dougherty [aut], Patrick Votruba [ctb], Ryan Lennon [ctb], Andrew Hanson [ctb], Krista Goergen [ctb], Emily Lundt [ctb], Brendan Broderick [ctb], Maddie McCullough [art]
Initial release
2021-02-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.