split_interval_counts {ageutils} | R Documentation |
Split interval counts
Description
split_interval_counts()
splits counts of a given age interval in to
counts for individual years based on a given weighting. Age intervals are
specified by their lower (closed) and upper (open) bounds, i.e. intervals
of the form [lower, upper).
Usage
split_interval_counts(
lower_bounds,
upper_bounds,
counts,
max_upper = 100L,
weights = NULL
)
Arguments
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. |
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 |
Value
A data frame with entries age
(in years) and count
.
Examples
split_interval_counts(
lower_bounds = c(0, 5, 10),
upper_bounds = c(5, 10, 20),
counts = c(5, 10, 30)
)
split_interval_counts(
lower_bounds = c(0, 5, 10),
upper_bounds = c(5, 10, Inf),
counts = c(5, 10, 30),
max_upper = 15
)
split_interval_counts(
lower_bounds = c(0, 5),
upper_bounds = c(5, 10),
counts = c(5, 10),
max_upper =10,
weights = 1:10
)