collect: collect results

View source: R/collect.R

collectR Documentation

collect results

Description

collect results

Usage

collect(v, fun, ...)

Arguments

v

a vector, list, array, etc.

fun

a function to collect on

...

passed to f

Details

Collect results by recursively calling the elements of the vector v. The first two elements are called as fun(v[1], v[2],...) The result is x. Then f(x, v[3]) is called and so forth, until all elements has been exhausted.

as such fun must take two arguments and return a single element, although there are no restrictions on what that single thing might be.

Examples

collect(v=letters, fun=function(x,y,...)paste(y,x, ...), sep='/')

dostats documentation built on May 11, 2022, 1:08 a.m.