Add 1-indexed age, period and cohort indices via match()
add_APC_by_match(df, age_name, period_name, age_order, period_order, M = 1)
Data frame with new columns: age_index, period_index, cohort_index
Data frame
Name of the age (or age-group) column (string).
Name of the period (e.g. year) column (string).
Character vector giving the desired ordering of age levels
Vector (numeric or character) giving the desired ordering of periods
Grid factor, defined as the ratio of age interval width to period interval width.