This function is an auxiliary used by top level functions where it is
guaranteed that age groups are standard abridged age groups. If Age
is specified,
this will work as well for other age groupings.
inferAgeIntAbr(Age, vec, OAG = FALSE, OAvalue = NA)
Age | integer. Vector of lower bound of each age group. |
---|---|
vec | Any vector, presumably a count, rate, or similar. |
OAG | logical. Whether or not the final age group open. Default |
OAvalue | numeric or integer. The value to use for the final age interval if |
An integer vector of length(vec)
indicating the width of the abridged age group that each
vector element corresponds to.
If based solely on the length of a vector, this will give erroneous results if ages
are anything other than standard abridged ages groups. If the final age group is open, the
interval width is defined as NA
. Inf
or -1
would have
also been a good choice, but we went with NA
.
#> [1] 1 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5inferAgeIntAbr(vec = vec, OAG = TRUE)#> [1] 1 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 NAinferAgeIntAbr(Age = 0:100, OAG = TRUE)#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [26] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [51] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [76] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [101] NA