Learn R Programming

yamlet (version 0.5.3)

decorations.data.frame: Retrieve Decorations for Data Frame

Description

Retrieve the decorations of a data.frame; i.e., the metadata used to decorate it. Returns a list with same names as the data.frame. By default, class attributes are excluded from the result, as this is an attribute you likely don't want to manipulate independently. Consider carefully whether the default handling of factor levels (see coerce argument) is appropriate for your application.

Usage

# S3 method for data.frame
decorations(
  x,
  ...,
  coerce = getOption("yamlet_coerce_decorations", FALSE),
  exclude_attr = getOption("yamlet_exclude_attr", "class")
)

Arguments

x

data.frame

...

optional unquoted column names to limit output (passed to select)

coerce

logical: whether to coerce factor levels to guide; alternatively, a key for the levels

exclude_attr

attributes to remove from the result

Value

named list of class 'decorations'

See Also

Other decorate: as_decorated.default(), as_decorated(), decorate.character(), decorate.data.frame(), decorate.list(), decorate(), decorations(), print.decorations(), redecorate()

Examples

Run this code
# NOT RUN {
library(csv)
library(magrittr)
file <- system.file(package = 'yamlet', 'extdata','quinidine.csv')
x <- decorate(as.csv(file))[,c('conc','Race')]
y <- decorate(as.csv(file))[,c('conc','Race')] %>% resolve
decorations(x)
decorations(y)
decorations(y, conc)
decorations(y, coerce = TRUE)
decorations(y, coerce = 'codelist')
decorations(y, exclude_attr = NULL)
# }

Run the code above in your browser using DataLab