aggregateCountsArray | R Documentation |
Aggregate an Array of Counts wrt One Dimension (Stratum)
aggregateCountsArray(counts, dim, grouping, ..., sort = TRUE)
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 |
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.
Sebastian Meyer
## 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)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.