View source: R/reaggregate_interval_counts.R
reaggregate_interval_counts | R Documentation |
reaggregate_interval_counts()
converts counts over one interval range to
another. It first splits counts of a given age interval in to counts for
individual years based on a given weighting. These are then aggregated to the
desired breaks. Functionally this is equivalent to, but more efficient than,
a call to split_interval_counts()
followed by aggregate_age_counts()
.
reaggregate_interval_counts(
lower_bounds,
upper_bounds,
counts,
breaks,
max_upper = 100L,
weights = NULL
)
lower_bounds , upper_bounds |
A pair of vectors representing the bounds of the intervals.
Missing (NA) bounds are not permitted. Double vectors will be coerced to integer. |
counts |
Vector of counts to be aggregated. |
breaks |
1 or more cut points in increasing (strictly) order. These correspond to the left hand side of the desired intervals (e.g. the closed side of [x, y). Double values are coerced to integer prior to categorisation. |
max_upper |
Represents the maximum upper bounds permitted upon splitting the data. Any upper bound greater than this will be replaced with this value prior to splitting. Double vectors will be coerced to integer. |
weights |
Population weightings to apply for individual years. If If specified, must be of length |
A data frame with 4 entries; interval
, lower_bound
, upper_bound
and an
associated count
.
reaggregate_interval_counts(
lower_bounds = c(0, 5, 10),
upper_bounds = c(5, 10, 20),
counts = c(5, 10, 30),
breaks = c(0L, 1L, 5L, 15L, 25L, 45L, 65L)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.