add_APC_by_match {MAPCtools} | R Documentation |
Add 1-indexed age, period and cohort indices via match()
Description
Add 1-indexed age, period and cohort indices via match()
Usage
add_APC_by_match(df, age_name, period_name, age_order, period_order, M = 1)
Arguments
df |
Data frame |
age_name |
Name of the age (or age-group) column (string). |
period_name |
Name of the period (e.g. year) column (string). |
age_order |
Character vector giving the desired ordering of age levels |
period_order |
Vector (numeric or character) giving the desired ordering of periods |
M |
Grid factor, defined as the ratio of age interval width to period interval width. |
Value
Data frame with new columns: age_index, period_index, cohort_index
[Package MAPCtools version 0.1.0 Index]