Learn R Programming

dostats (version 1.3.3)

collect: 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

Run this code
# NOT RUN {
collect(v=letters, fun=function(x,y,...)paste(y,x, ...), sep='/')
# }

Run the code above in your browser using DataLab