Description Usage Arguments Details Value See Also Examples
View source: R/EvalExpressions.R
EvalExpressions
evaluates one or more expressions, either in string format
or as expression
objects.
1 | EvalExpressions(expressions, envir = parent.frame())
|
expressions |
an expression, or a collection of expressions. |
envir |
the |
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.
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.
1 2 3 4 5 6 7 8 9 10 11 12 | 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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.