This function calculates the groupwise mean.

groupmean(x, f, na.rm = TRUE)

Arguments

x

double, values

f

factor, splitting factor/grouping variable.

na.rm

logical(1), see mean() for details.

Value

Name double with mean values per split/group.

Examples

groupmean(1:9, rep(1:3, 3))
#> 1 2 3 
#> 4 5 6