Decorates a data.frame. Expects metadata in yamlet format, and loads it onto columns as attributes.
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
decorate.list- 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).
See also
decorate.list
Other interface:
canonical.decorated(),
classified.data.frame(),
decorate.character(),
desolve.decorated(),
enscript.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(),
selected.default(),
write_yamlet()
Other decorate:
as_decorated(),
as_decorated.default(),
decorate(),
decorate.character(),
decorate.list(),
decorate_groups(),
decorate_groups.data.frame(),
decorations(),
decorations.data.frame(),
decorations_groups(),
decorations_groups.data.frame(),
group_by_decorations(),
group_by_decorations.data.frame(),
redecorate(),
undecorate(),
undecorate.default()
Examples
# find data path
library(csv)
file <- system.file(package = 'yamlet', 'extdata','quinidine.csv')
file
#> [1] "/home/runner/work/_temp/Library/yamlet/extdata/quinidine.csv"
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))