byX: Calls FUN on a subset of data in blocks of size 'subset_size'...

Description Usage Arguments Details Value Examples

View source: R/fcn_misc.R

Description

One subset consists of 'subset_size' unique groups and thus of all rows which in 'data' which have any of these groups. The last subset might have less groups, if the number of unique groups is not dividable by subset_size.

Usage

1
byX(data, indices, subset_size = 5, FUN, sort_indices = TRUE, ...)

Arguments

data

Data.frame whose subsets to use on FUN

indices

Vector of group assignments, same length as nrow(data)

subset_size

Number of groups to use in one subset

FUN

Function applied to subsets of data

sort_indices

Sort groups (by their sorted character(!) names) before building subsets

...

More arguments to FUN

Details

FUN is applied on each subset.

Value

list of function result (one entry for each subset)

Examples

1
2
 byX(data.frame(d=1:10), 1:10, 2, sum)
 

PTXQC documentation built on Feb. 9, 2018, 6:08 a.m.