Build YAML Config
design.RdDesign the project configuration.
Details
design is the core function / verb when it comes to building configuration.
The function understands the following instructions passed to ...:
projectto create a config from scratchitemto add an item group to the project configattributeto add an attribute to a given item group.
An instruction is always formed of a key (project, item or attribute) and
a value. The value can either be a length-one character string or a named
character vector.
The project = "test" instruction is used in almost all function documentation
examples to init a project config.
item = "foo" or item = c(id = "foo", description = "not bar") are used
to add an item group to the project.
attribute = c(item = "foo", name = "value", type = "integer") creates an
attribute named 'value' that will accept integers inside the item group 'foo'.
Multiple instructions are supported as recursion is implemented (the function can call itself to execute each instruction and merge the outputs).
As the package grammar is designed for a layered approach, design only covers
attribute creation without fine tuning.
This means it creates attribute(s) with name & type only.
use
extendto create an attribute with fine tuning.use
hide,display,skip,include&refreshto set specific attribute behaviors.
In addition to the named instructions, a single unnamed argument is accepted
among ... to support piping from the config object (see examples).
If multiple unnamed objects are passed, an error will be thrown.
Examples
if (FALSE) { # \dontrun{
# create project config from scratch
config <- design(project = "foo")
# add (single) item group
config |> design(item = "foo")
config |> design(item = c(id = "foo", description = "x"))
# add (multiple) item groups
config |> design(item = "foo",
item = "bar")
config |> design(item = c(id = "foo", description = "x"),
item = c(id = "bar", description = "z"))
config |> design(item = c(id = "foo", description = "x"),
item = "bar")
# add (single) attribute to item group
config |> design(item = "foo",
attribute = c(item = "foo", name = "value", type = "integer"))
# add (multiple) attributes to item group
config |> design(item = "foo",
attribute = c(item = "foo", name = "value", type = "integer"),
attribute = c(item = "foo", name = "comment", type = "character"))
# if instruction is not understood
design(dream = "draw me a sheep")
} # }