Learn R Programming

yamlet (version 0.6.5)

[.decorated: Subset Decorated

Description

Subsets 'decorated', retaining attributes.

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

Usage

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

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

Arguments

x

object to subset

...

passed to next method

.promote

whether to auto-promote plural attributes

Value

decorated

decorated

See Also

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

Other promote: filter.decorated(), promote.default(), promote(), singularity()

Examples

Run this code
# NOT RUN {
a <- as_decorated(as.list(setNames(letters[1:3], LETTERS[1:3])))
attr(a$B, 'label') <- 'foo'
a <- a[1:3]
attributes(a)
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)
# }

Run the code above in your browser using DataLab