aggregate: Aggregate data based on given grouping.

Description Usage Arguments Value Examples

View source: R/aggregate.R

Description

aggregate aggregates data based on the specified aggregation method.

Usage

1
aggregate(population, variables, strata, operation = "mean", ...)

Arguments

population

tbl with grouping (metadata) and observation variables.

variables

character vector specifying observation variables.

strata

character vector specifying grouping variables for aggregation.

operation

optional character string specifying method for aggregation. This must be one of the strings "mean", "median", "mean+sd".

...

optional arguments passed to aggregation operation

Value

aggregated data of the same class as population.

Examples

1
2
3
4
5
6
7
8
9
population <- tibble::data_frame(
   Metadata_group = c("control", "control", "control", "control",
                      "experiment", "experiment", "experiment", "experiment"),
   Metadata_batch = c("a", "a", "b", "b", "a", "a", "b", "b"),
   AreaShape_Area = c(10, 12, 15, 16, 8, 8, 7, 7)
 )
variables <- c("AreaShape_Area")
strata <- c("Metadata_group", "Metadata_batch")
aggregate(population, variables, strata, operation = "mean")

cytominer documentation built on Sept. 18, 2017, 1:03 a.m.