do: Compose and Forget in one go.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/do.R

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

1

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

path, forget

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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)))

matteoprovenzano/kriens-r documentation built on May 21, 2019, 12:59 p.m.