calcAgeN | R Documentation |
Assign single ages to age groups of equal and arbitrary width, and also optionally shifted.
calcAgeN(Age, N = 5, shiftdown = 0)
Age |
integer. Vector of single ages (lower bound). |
N |
integer. Desired width of resulting age groups. |
shiftdown |
integer. Move the grouping down by one or more single ages. Optional argument. |
If you shift the groupings, then the first age groups may have a negative lower bound
(for example of -5). These counts would be discarded for the oscillatory version of Sprague smoothing,
for example, but they are preserved in this function. The important thing to know is that if you shift
the groups, the first and last groups won't be N years wide. For example if shiftdown
is 1,
the first age group is 4-ages wide.
An integer vector of length(Age)
indicating the age group that each single age belongs to.
Age <- 0:100
calcAgeN(Age)
calcAgeN(Age, N = 4)
calcAgeN(Age, N = 3)
calcAgeN(Age, shiftdown = 1)
calcAgeN(Age, shiftdown = 2)
# can be used to group abridged into equal 5-year intervals
AgeAbr <- c(0,1,5,10,15,20)
calcAgeN(AgeAbr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.