as.APC.df {MAPCtools} | R Documentation |
Add 1-indexed APC columns to data frame, handling numeric or categorical age/period
Description
Add 1-indexed APC columns to data frame, handling numeric or categorical age/period
Usage
as.APC.df(data, age, period, age_order = NULL, period_order = NULL, M = 1)
Arguments
data |
Data frame with age and period columns. |
age |
Age column in |
period |
Period column in |
age_order |
(Optional) Character vector giving the desired order of age levels.
If NULL and the |
period_order |
(Optional) Vector (numeric or character) giving the desired order of periods.
If NULL and |
M |
Grid factor, defined as the ratio of age interval width to period interval width. Defaults to 1 (i.e. assuming equal sized age and period increments). |
Value
The data frame with new columns \code{age_index}, \code{period_index}, \code{cohort_index}, and sorted by \code{(age_index, period_index)}.
[Package MAPCtools version 0.1.0 Index]