Learn R Programming

ff (version 4.5.0)

CFUN: Collapsing functions for batch processing

Description

These are used in aggregating the chunks resulting from batch processing. They are usually called via do.call

Usage

ccbind(...)
crbind(...)
cfun(..., FUN, FUNARGS = list())
cquantile(..., probs = seq(0, 1, 0.25), na.rm = FALSE, names = TRUE, type = 7)
csummary(..., na.rm = "ignored")
cmedian(..., na.rm = FALSE)
clength(..., na.rm = FALSE)
csum(..., na.rm = FALSE)
cmean(..., na.rm = FALSE)

Value

depends on the CFUN used

Arguments

...

...

FUN

a aggregating function

FUNARGS

further arguments to the aggregating function

na.rm

TRUE to remove NAs

probs

see quantile

names

see quantile

type

see quantile

ff options

xx TODO: extend this for weighted means, weighted median etc.,
google "Re: [R] Weighted median"

Author

Jens Oehlschlägel

Details

CFUNFUNcomment
ccbindcbindlike cbind but respecting names
crbindrbindlike rbind but respecting names
cfuncrbind the input chunks and then apply 'FUN' to each column
cquantilequantilecrbind the input chunks and then apply 'quantile' to each column
csummarysummarycrbind the input chunks and then apply 'summary' to each column
cmedianmediancrbind the input chunks and then apply 'median' to each column
clengthlengthcrbind the input chunks and then determine the number of values in each column
csumsumcrbind the input chunks and then determine the sum values in each column
cmeanmeancrbind the input chunks and then determine the (unweighted) mean in each column

In order to use CFUNs on the result of lapply or ffapply use do.call.

See Also

ffapply, do.call, na.count

Examples

Run this code
   X <- lapply(split(rnorm(1000), 1:10), summary)
   do.call("crbind", X)
   do.call("csummary", X)
   do.call("cmean", X)
   do.call("cfun", c(X, list(FUN=mean, FUNARGS=list(na.rm=TRUE))))
   rm(X)

Run the code above in your browser using DataLab