add_APC_by_match: Add 1-indexed age, period and cohort indices via match()

View source: R/export-DataPreprocessing.R

add_APC_by_matchR 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

MAPCtools documentation built on June 25, 2025, 5:09 p.m.