R: Fast conditional mean

byMean {ffbase} | R Documentation

## 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`

[Package ffbase version 0.13.1 Index]