do {kriens} | R Documentation |
Compose and Forget in one go.
Description
do
allows to specify the list of function directly as its arguments.
It return a function which is the composition of every argument with the continuation already forgotten.
Usage
do(...)
Arguments
... |
The functions that must be composed together. |
Value
A function of the type g(x)
which can be directly used on the input.
Author(s)
Matteo Provenzano
http://www.alephdue.com
See Also
Examples
# define a function that doubles its argument
times.two <- function(x, ret) {
ret(x*2)
}
# define a function that loops over a list of list and double every element
loop <- do(lapply, lapply, times.two)
#returns list(list(2, 4, 6), list(8,10,12))
loop(list(list(1,2,3),list(4,5,6)))
[Package kriens version 0.1 Index]