sub-.decorated: a <- as_decorated(as.list(setNames(letters[1:3],...

[.decoratedR Documentation

a <- as_decorated(as.list(setNames(letters[1:3], LETTERS[1:3]))) attr(a$B, 'label') <- 'foo' a <- a[1:3] attributes(a) Subset Decorated

Description

Subsets decorated. Calls promote internally to improve ambiguous conditional attributes where possible.

Usage

## S3 method for class 'decorated'
x[..., .promote = getOption("yamlet_promote", TRUE)]

Arguments

x

decorated

...

passed to next method

.promote

whether to auto-promote plural attributes

Value

decorated (unless dimension is dropped)

See Also

Other promote: filter.decorated(), promote.data.frame(), promote.list(), promote(), singularity()

Other decorated: [<-.decorated(), [[.decorated(), [[<-.decorated(), merge.decorated(), names<-.decorated()

Examples

library(magrittr)
file <- system.file(package = 'yamlet', 'extdata','phenobarb.csv')
x <- file %>% decorate
x %>% decorations(event, value)

# Subsetting promotes automatically.
x[x$event == 'dose',] %>% decorations(event, value)
x[x$event == 'conc',] %>% decorations(event, value)

# Dimension may be dropped
x[1,1]

# Conventional subsetting
a <- as_decorated(as.list(setNames(letters[1:3], LETTERS[1:3])))
attr(a$B, 'label') <- 'foo'
a <- a[1:3]
attributes(a)


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