StatisticsByGroup: StatisticsByGroup

View source: R/statisticbygroup.R

StatisticsByGroupR Documentation

StatisticsByGroup

Description

StatisticsByGroup

Usage

StatisticsByGroup(x, group, weights = NULL, FUN = Mean)

Arguments

x

A data.frame or matrix.

group

A variable indicating group membership. Either a factor or coerced to a factor.

weights

The sampling or replication weights.

FUN

A function that can handle a weight argument.

Examples

## Two variables with a single observation and a single group
dat <- matrix(c(1.0, 2.0), 1, 2)
stopifnot(identical(unname(StatisticsByGroup(dat, 1)), dat))

NumbersInternational/flipStatistics documentation built on Feb. 26, 2024, 5:40 a.m.