EvalExpressions {gramEvol} | R Documentation |
Evaluate a collection of Expressions
Description
EvalExpressions
evaluates one or more expressions, either in string format
or as expression
objects.
Usage
EvalExpressions(expressions, envir = parent.frame())
Arguments
expressions |
an expression, or a collection of expressions. |
envir |
the |
Details
EvalExpressions
is a wrapper around
eval
and parse
functions in R base package.
It can handle a single, a vector or a list of expressions,
character strings or GEPhenotype
objects.
The envir
argument is directly passed to eval
function. If it is not specified,
the parent frame (i.e., the environment where the call to eval
was made) is used instead.
EvalExpressions
only evaluates terminal expressions and character strings.
Evaluating non-terminal expressions will result in a warning and NA
is returned.
Value
If one expression is evaluated, a vector of numeric values is returned. Otherwise a data frame with result of each expression in a separate column is returned.
See Also
Examples
A <- 1:6
B <- 1
EvalExpressions("A - B")
# a vector of text strings
exprs <- c("A + B", "A - B")
EvalExpressions(exprs, data.frame(A = A, B = B))
# a vector of expressions
exprs <- expression(A + B, A - B)
EvalExpressions(exprs, data.frame(A = A, B = B))