decorate.data.frame {yamlet} | R Documentation |
Decorate Data Frame
Description
Decorates a data.frame. Expects metadata in yamlet format, and loads it onto columns as attributes.
Usage
## S3 method for class 'data.frame'
decorate(
x,
meta = NULL,
...,
persistence = getOption("yamlet_persistence", TRUE)
)
Arguments
x |
data.frame |
meta |
file path for corresponding yaml metadata, or a yamlet; an attempt will be made to guess the file path if x has a 'source' attribute |
... |
passed to |
persistence |
whether to coerce decorated columns to 'dvec' where suitable method exists |
Details
As of v0.8.8, the data.frame method for decorate()
coerces affected columns using as_dvec
if persistence
is true and a suitable method
exists. 'vctrs' methods are implemented for class
dvec
to help attributes persist during
tidyverse operations. Details are described in
c.dvec
. Disable this functionality
with options(yamlet_persistence = FALSE)
.
Value
class 'decorated' 'data.frame'
See Also
decorate.list
Other interface:
canonical.decorated()
,
classified.data.frame()
,
decorate.character()
,
desolve.decorated()
,
ggplot.decorated()
,
io_csv.character()
,
io_csv.data.frame()
,
io_res.character()
,
io_res.decorated()
,
io_table.character()
,
io_table.data.frame()
,
io_yamlet.character()
,
io_yamlet.data.frame()
,
is_parseable.default()
,
mimic.default()
,
modify.default()
,
promote.list()
,
read_yamlet()
,
resolve.decorated()
,
scripted.default()
,
selected.default()
,
write_yamlet()
Other decorate:
as_decorated.default()
,
as_decorated()
,
decorate.character()
,
decorate.list()
,
decorate_groups.data.frame()
,
decorate_groups()
,
decorate()
,
decorations.data.frame()
,
decorations_groups.data.frame()
,
decorations_groups()
,
decorations()
,
group_by_decorations.data.frame()
,
group_by_decorations()
,
redecorate()
Examples
# find data path
library(csv)
file <- system.file(package = 'yamlet', 'extdata','quinidine.csv')
file
dat <- as.csv(file) # dat now has 'source' attribute
# use source attribute to find metadata
a <- decorate(as.csv(file))
# supply metadata path (or something close) explicitly
b <- decorate(dat, meta = file)
# these are equivalent
stopifnot(identical(a, b))