Description Usage Arguments Details Value See Also Examples
Functions to transform a base expression containing free variables into a list or a vector of expressions, based on variable ranges and additional conditions.
1 2 3 4 5 6 7 | gen.list.expr(.expr, ...)
gen.vector.expr(.expr, ...)
gen.named.list.expr(.str, .expr, ...)
gen.named.vector.expr(.str, .expr, ...)
|
.expr |
A base expression which is partially evaluated for all combinations of variables. It may still contain free variables. |
... |
Arbitrary many variable ranges and conditions. |
.str |
A character pattern, containing expressions to be evaluated in {}-brackets. |
See gen.list
for more details on the .expr
and ...
parameters.
See gen.named.list
for more details on the .str
parameter.
For variables with underscores additionally the evaluation of indices in ()
-brackets is supported.
For example, an expression x_(i+1)
is evaluated as x_3
for i = 2
.
Returns an expression containing a list or a vector which might be evaluated later.
The argument .expr
is partially evaluated, where all free variables are substituted for which a range is given.
The other variables remain untouched.
gen.list
to generate lists,
gen.named.list
to generate named lists,
and listcompr for an overview of all list comprehension functions.
1 2 3 4 5 6 7 8 | # An expression which is partially evaluated
gen.list.expr(a_i + 2 * i, i = 1:4)
# Generate an expression with placeholders a_i,
# generate data for a_1, ..., a_4 and finally evaluate it
expr <- gen.vector.expr(a_i + a_(j+1), i = 1:3, j = 1:3, i != j)
data <- gen.data.frame(c(a_1 = a_1, ..., a_4 = a_4), a_ = 1:2)
eval(expr, data)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.