Description Usage Arguments Value Author(s) References See Also Examples
See generic: buildExpressionFromYaml
1 2 3 | ## S4 method for signature 'ObjectReferenceYamlParsed.S3'
buildExpressionFromYaml(yaml,
where = parent.frame(), ...)
|
yaml |
|
where |
|
... |
Further arguments to be passed to subsequent functions/methods. |
ObjectReferenceYamlProcessed.S3
.
Processed YAML markup.
Janko Thyson janko.thyson@rappster.de
http://github.com/Rappster/yamlr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ## Not run:
## Get //
yaml <- getYaml(
from = function() {
"object-ref: {id: x_1, where: .GlobalEnv, as: ref_1}"
},
ctx = YamlContext.ObjectReference.S3()
)
## Parse //
yaml <- parseYaml(yaml = yaml)
## Build //
yaml <- buildExpressionFromYaml(yaml = yaml)
## Two ways of accessing expressions //
## 1) Via 'parsed':
ls(yaml$parsed$x_1$expr)
yaml$parsed$x_1$expr$exists
yaml$parsed$x_1$expr$validate
yaml$parsed$x_1$expr$get_assign
## 2) Via 'expr':
ls(yaml$expr$x_1)
yaml$expr$x_1$exists
yaml$expr$x_1$validate
yaml$expr$x_1$get_assign
## NOTE
## The environment in `expr${id}` corresponds to the environment
## in `parsed${id}$expr. So expressions are not actually stored redundantly
## as environments implement a "pass-by-referenc" instead of the otherwise
## typical "pass-by-value" paradigm.
## Environment `expr` simply exists as a shorthand for accessing expressions
## Example of expression execution //
## Validity checks:
suppressWarnings(rm(x_1))
eval(yaml$parsed$x_1$expr$exists)
eval(yaml$parsed$x_1$expr$validate)
x_1 <- 10
eval(yaml$parsed$x_1$expr$exists)
eval(yaml$parsed$x_1$expr$validate)
## The line that contained the YAML markup in 'from' above will be substituted
## by this expression
eval(yaml$parsed$x_1$expr$get_assign)
ref_1
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.