This is a frequent grouping situation. For a given vector of lower age bounds, as implied by AgeInt, repeat each value N times, where N is the width of the corresponding age interval. Age intervals are in this case given, and age lower bound values are calculated from AgeInt vector.

int2ageN(AgeInt, OAG)

Arguments

AgeInt

integer or numeric. Vector of age intervals.

OAG

logical. Whether or not the final age group open. Default FALSE. See details

Value

integer vector of elements of Age repeated once for each implied single age.

Details

If OAG = TRUE then the last value is given just once, irrespective of the final value of AgeInt, otherwise the final age interval is repeated AgeInt[length(AgeInt)] times. Here intervals do not need to be of uniform width.

Examples

int5 <- rep(5,21) (ageN1 <- int2ageN(int5, OAG = FALSE))
#> [1] 0 0 0 0 0 5 5 5 5 5 10 10 10 10 10 15 15 15 #> [19] 15 15 20 20 20 20 20 25 25 25 25 25 30 30 30 30 30 35 #> [37] 35 35 35 35 40 40 40 40 40 45 45 45 45 45 50 50 50 50 #> [55] 50 55 55 55 55 55 60 60 60 60 60 65 65 65 65 65 70 70 #> [73] 70 70 70 75 75 75 75 75 80 80 80 80 80 85 85 85 85 85 #> [91] 90 90 90 90 90 95 95 95 95 95 100 100 100 100 100
(ageN2 <- int2ageN(int5, OAG = TRUE))
#> [1] 0 0 0 0 0 5 5 5 5 5 10 10 10 10 10 15 15 15 #> [19] 15 15 20 20 20 20 20 25 25 25 25 25 30 30 30 30 30 35 #> [37] 35 35 35 35 40 40 40 40 40 45 45 45 45 45 50 50 50 50 #> [55] 50 55 55 55 55 55 60 60 60 60 60 65 65 65 65 65 70 70 #> [73] 70 70 70 75 75 75 75 75 80 80 80 80 80 85 85 85 85 85 #> [91] 90 90 90 90 90 95 95 95 95 95 100