eply {eply} | R Documentation |
Function eply
Description
Apply a function over a data frame of quoted expressions.
Parallel execution is available using the .split
and .tasks
arguments.
Usage
eply(.fun, .expr, .with = parent.frame())
Arguments
.fun |
function to evaluate. |
.expr |
data frame of quoted expressions. Column names must
contain the argument names of |
.with |
list, data frame, or environment with the
data accessible to |
Details
.fun
is a function, and .expr
is a data frame.
In .expr
, each row stands for a single call to .fun
, and each
column stands for an argument. Each element is a quoted expression that
uses the data in .with
during evaluation.
When eply
is called on each row, the expressions
are evaluated on .with
,
and the results are given to .fun
as function arguments.
The column names of .expr
must
contain the argument names of .fun
.
With .tasks
and .split
, Mac and Linux users can
distribute the work over multiple parallel tasks. See the vignette for an
example (vignette("eply")
).
Value
a list or vector of return values of .fun
.
See Also
Examples
# Get an example data frame of commands that evaluate to function arguments.
.expr <- example.expr()
.fun <- example.fun # Get an example collection of functions.
# Get an example list of supporting data. Could be an environment.
.with <- example.with()
# Row-by-row, evaluate the code in .expr and feed the results to the function.
eply(.fun = .fun, .expr = .expr, .with = .with)