add_cohort_column: Add cohort column to data frame

View source: R/export-DataPreprocessing.R

add_cohort_columnR Documentation

Add cohort column to data frame

Description

Adds a column for birth cohorts to a data frame, derived from specified age and period columns through the relation cohort = period - age.

Usage

add_cohort_column(data, age, period, cohort_name = "cohort")

Arguments

data

Data frame with age and period column.

age

Age column in data.

period

Period column in data.

cohort_name

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

Value

Data frame with additional column for birth cohorts added.


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