canonical.decorated: Sort Decorations

View source: R/canonical.R

canonical.decoratedR Documentation

Sort Decorations

Description

Enforces canonical attribute order for class 'decorated'. Set of default_keys will be augmented with all observed attribute names and will be expanded or reduced as necessary for each data item.

Usage

## S3 method for class 'decorated'
canonical(
  x,
  default_keys = getOption("yamlet_default_keys", list("label", "guide")),
  ...
)

Arguments

x

decorated

default_keys

attribute names in preferred order

...

ignored

Value

decorated

See Also

Other canonical: canonical.yamlet(), canonical()

Other interface: classified.data.frame(), decorate.character(), decorate.data.frame(), 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(), selected.default(), write_yamlet()

Examples

# make some decorated data
library(magrittr)
x <- data.frame(x = 1, y = 1, z = factor('a'))
x %<>% decorate('
x: [ guide: mm, desc: this, label: foo ]
"y": [ guide: bar, desc: other ]
')

# retrieve decorations: label not first!
decorations(x)

# sort label first by default
decorations(canonical(x))

# equivalent invocation
canonical(decorations(x))


yamlet documentation built on Oct. 6, 2023, 9:07 a.m.