labels.fmt: Extract labels from a user-defined format

View source: R/fmt.R

labels.fmtR Documentation

Extract labels from a user-defined format

Description

The labels function creates a vector of labels associated with a user-defined format.

Usage

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

Arguments

object

A user-defined format of class "fmt".

...

Following arguments.

Details

The condition function creates a condition as part of a format definition. Each condition has a label as part of its definition. The labels function extracts the labels from the conditions and returns them as a vector. While the labels will typically be of type character, they can be of any data type. See the link{condition} function help for further details.

Value

A vector of label values.

See Also

value to define a format, condition to define the conditions for a format, and fapply to apply the format to a vector.

Other fmt: as.data.frame.fmt(), as.fmt.data.frame(), as.fmt(), condition(), is.format(), print.fmt(), value()

Examples


# Define format
fmt1 <- value(condition(x == "A", "Label A"),
              condition(x == "B", "Label B"), 
              condition(TRUE, "Other"))
              
# Extract labels
labels(fmt1)

fmtr documentation built on Nov. 10, 2023, 9:07 a.m.