Learn R Programming

ffbase (version 0.6-2)

byMean: Fast conditional mean

Description

byMean works like a very fast version of tapply with (weighted) FUN=mean or FUN=weighted.mean.

Usage

byMean(x, by, na.rm = FALSE, weight = NULL, ...)

Arguments

x
numeric vector to be averaged
by
(list of) factor(s) for which the mean will be calculated
na.rm
logical If TRUE NA values will be removed
weight
numeric with of same length as x
...
not used

Value

  • array with dimensions of by