aggregateCountsArray {hhh4contacts} | R Documentation |
Aggregate an Array of Counts wrt One Dimension (Stratum)
Description
Aggregate an Array of Counts wrt One Dimension (Stratum)
Usage
aggregateCountsArray(counts, dim, grouping, ..., sort = TRUE)
Arguments
counts |
an (integer) array of counts with |
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 |
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
## 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)))
[Package hhh4contacts version 0.13.3 Index]