aggregateCountsArray: Aggregate an Array of Counts wrt One Dimension (Stratum)

Description Usage Arguments Value Author(s) Examples

View source: R/aggregateCountsArray.R

Description

Aggregate an Array of Counts wrt One Dimension (Stratum)

Usage

1

Arguments

counts

an (integer) array of counts with dimnames, e.g., counts or pop2011.

dim

the dimension index of the stratum defining groups.

grouping, ...

how the groups should be built.

sort

logical indicating if the resulting array should be ordered by the grouping levels in the dim dimension.

Value

an array with similar dimensions as the input counts except for the dim dimension, which will be smaller due to the aggregation as specified by the grouping argument.

Author(s)

Sebastian Meyer

Examples

1
2
3
4
5
6
7
8
## works for matrices
aggregateCountsArray(pop2011, dim = 2, grouping = c(2,1,3,2,4))
aggregateCountsArray(pop2011, dim = 1, grouping = list(
    "a" = c("chwi","span","zehl"),
    "b" = c("neuk","scho")
))
## and of course for arrays
str(aggregateCountsArray(counts, dim = 3, grouping = c(1, 3, 4)))

hhh4contacts documentation built on July 4, 2017, 9:44 a.m.