explicit_guide.yamlet: Coerce Yamlet Guide to Something More Explicit

Description Usage Arguments Details Value See Also Examples

View source: R/explicit_guide.R

Description

Coerces yamlet 'guide' keys to something more explicit. The key 'guide' generally suggests a guide to interpretation of a data item, such as units, formats, codelists, and encodings. The idea here is to replace 'guide' with something explicit in case required downstream.

Usage

1
2
## S3 method for class 'yamlet'
explicit_guide(x, ..., default = "guide", data = NULL)

Arguments

x

yamlet

...

passed to select to limit scope

default

length-one character: the default key

data

optional data.frame for testing guides with length > 1

Details

The key 'guide' is replaced as follows for the first test that succeeds, or replaced with the default if none do.

* If the value of 'guide' is of length greater than one (and data is not supplied), key becomes 'codelist'. * If the value of 'guide' is_parseable, key becomes 'units'. * If the value of 'guide' contains two or more percent signs, key becomes 'format' (i.e. a 'format' string for a date or time class). * If the value of 'guide' is (encoded), key becomes 'encoding'.

If data is supplied, guides with length greater than one are checked to see if they evaluate to conditions in data context (see isConditional.list). If so, inferences are based on the first guide element rather than the guide as a whole.

Value

yamlet

See Also

Other explicit_guide: explicit_guide.data.frame(), explicit_guide(), implicit_guide.data.frame(), implicit_guide()

Examples

1
2
3
4
5
6
7
library(magrittr)
'CONC: [ concentration, µg/mL ]' %>% as_yamlet %>% explicit_guide
'RACE: [ subject race, [ Caucasian: 0, Latin: 1, Black: 2 ]]' %>% as_yamlet %>% explicit_guide
'RACE: [ subject race, [ Caucasian, Latin, Black ]]' %>% as_yamlet %>% explicit_guide
'RACE: [ subject race, //0/Caucasian//1/Latin//2/Black// ]' %>% as_yamlet %>% explicit_guide
'DATE: [ date, "%Y-%m-%d" ]' %>% as_yamlet %>% explicit_guide
'PRSE: [ standard error, "%" ]' %>% as_yamlet %>% explicit_guide

yamlet documentation built on July 19, 2021, 1:06 a.m.