promote.list | R Documentation |
Promotes attributes of list-like objects.
For the plural attributes of each element,
any singularity is promoted to the sole attribute.
Reserved attributes are untouched.
Methods filter.decorated
and [.decorated
automatically attempt to promote attributes for all elements.
## S3 method for class 'list' promote( x, ..., .reserved = getOption("yamlet_promote_reserved", c("class", "levels", "labels", "names")) )
x |
list, or list-like |
... |
indicated elements |
.reserved |
attributes to leave untouched |
same class as x
filter.decorated [.decorated
Other promote:
[.decorated()
,
filter.decorated()
,
promote.data.frame()
,
promote()
,
singularity()
Other interface:
canonical.decorated()
,
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()
,
read_yamlet()
,
resolve.decorated()
,
selected.default()
,
write_yamlet()
library(magrittr) file <- system.file(package = 'yamlet', 'extdata','phenobarb.csv') x <- file %>% decorate # Note that there are two elements each for value label and value guide. x %>% decorations(event, value) # After filtering, only one set is relevant. # promote() identifies and retains such. x %>% dplyr:::filter.data.frame(event == 'dose') %>% decorations(value) x %>% dplyr:::filter.data.frame(event == 'dose') %>% promote %>% decorations(value) # If for some reason we do a partial promote, value attributes are unaffected. # Nonsense example: x %>% dplyr:::filter.data.frame(event == 'dose') %>% promote(event) %>% decorations(value) # However, the 'decorated' method for filter() calls promote() internally. x %>% filter(event == 'dose') %>% decorations(value)