gapply applies a function on a data.frame by using named list
entries as grid. Support of multicore processing via mclapply.
levels is a method to retrieve the grid of a gapply object.
as.data.frame is a simplified rbind version which adds the grid
to the output.
Usage
gapply(d, by, fun, ..., drop = TRUE, cores = 1)
## S3 method for class 'gapply':
levels(x)
## S3 method for class 'gapply':
as.data.frame(x, ...)
## S3 method for class 'gapply':
as.data.table(x, keyv = NULL, ...)
Arguments
d
A data.frame or data.table object.
by
A character vector with colnames for the grid to subset.
fun
A function to apply on d.
...
Additional arguments to fun or to as.data.frame method.
drop
Drop grid columns for fun.
cores
Number of multicores as mc.cores in mclapply.
x
Object of class gapply.
keyv
Character vector for data.table keys.
Details
The output of gapply is a list inheriting from the S3 class gapply which stores
the grid of the original data. Support for subsetting grid entries is not yet
supported. The function fun receives the subset of the data frame as
first argument.