Decorates a list-like object. Takes metadata in yamlet format and loads it onto corresponding list elements as attributes.
Arguments
- x
object inheriting from
list- meta
file path for corresponding yaml metadata, or a yamlet or something coercible to yamlet; an attempt will be made to guess the file path if x has a 'source' attribute (as for
as.csv)- ...
passed to
as_yamlet.character(by method dispatch)- ext
file extension for metadata file, if relevant
- persistence
whether to coerce decorated items to 'dvec' where suitable method exists
- overwrite
whether to overwrite attributes that are already present (else give warning)
Details
As of v0.8.8, attribute persistence is supported
by optionally coercing decorated items to class 'dvec'
where suitable methods exist. persistence
is false by default for the list method
but true by default for the data.frame method.
See also decorate.data.frame.
See also
Other decorate:
as_decorated(),
as_decorated.default(),
decorate(),
decorate.character(),
decorate.data.frame(),
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
example(decorate.data.frame)
#>
#> dcrt..> # find data path
#> dcrt..> library(csv)
#>
#> dcrt..> file <- system.file(package = 'yamlet', 'extdata','quinidine.csv')
#>
#> dcrt..> file
#> [1] "/home/runner/work/_temp/Library/yamlet/extdata/quinidine.csv"
#>
#> dcrt..> dat <- as.csv(file) # dat now has 'source' attribute
#>
#> dcrt..> # use source attribute to find metadata
#> dcrt..> a <- decorate(as.csv(file))
#>
#> dcrt..> # supply metadata path (or something close) explicitly
#> dcrt..> b <- decorate(dat, meta = file)
#>
#> dcrt..> # these are equivalent
#> dcrt..> stopifnot(identical(a, b))