Learn R Programming

MAPCtools (version 0.1.0)

add_cohort_index: Add cohort column to data frame

Description

Adds a column for cohort indices to a data frame, derived from specified age and period index columns through the relationship cohort index = period index - age index + max(age index).

Usage

add_cohort_index(data, age_index, period_index, cohort_name = "cohort_index")

Value

Data frame with additional column for cohort indices.

Arguments

data

Data frame with age and period columns.

age_index

Age index column in data.

period_index

Period index column in data.

cohort_name

Name of the cohort index column to be created. Defaults to "cohort_index".