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

age2ageN(Age, AgeInt = NULL, OAG = FALSE)

## Arguments

Age integer. Vector of lower age bounds. integer vector of age group widths. 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 not repeated, otherwise the final age interval is assumed to be the same width as the penultimate. Here intervals do not need to be of uniform width.

## Examples

age1 <- seq(0,100,by=5)
(ageN1 <- age2ageN(age1, 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 <- age2ageN(age1, 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