e.g. age banded population, or a discrete probability distribution e.g. a serial interval distribution.
Arguments
- x
a set of upper limits of bands, e.g. for age: 0-14;15-64;65-79;80+ is 15,65,80,NA
- y
a set of quantities for each band e.g. population figures
- xout
a set of new upper limits
- xlim
Upper and lower limits for x. if the last band is e.g 80+ in the input and we want to know the 85+ band in the output some kind of maximum upper limit is needed to interpolate to.
- ytotal
upper and lower limits for y. If the interpolation values fall outside of x then the in and max limits of y are given by this.
- digits
if the
xout
value is continuous then how many significant figures to put in the labels- labelling
are the
xout
values interpretable as aninclusive
upper limit, or anexclusive
upper limit, or as an upper limit of an `positive_integer`` quantity- sep
seperator for names e.g.
18-24
or18 to 24
Examples
ul = stringr::str_extract(england_demographics$class, "_([0-9]+)",group = 1) %>%
as.numeric()
tmp = reband_discrete(
ul, england_demographics$population,
c(5,10,15,40,80), xlim=c(0,120))
tmp
#> 0-4 5-9 10-14 15-39 40-79 80+
#> 3745688 3361511 3384582 18173104 25360084 2464731
sum(tmp)
#> [1] 56489700
sum(england_demographics$population)
#> [1] 56489700