make_age_group_var: Make an age group variable

View source: R/make_vars.R

make_age_group_varR Documentation

Make an age group variable

Description

make_age_group_var() creates a 3-level age group variable in ACS, CPS ASEC, or basic monthly CPS microdata. Levels include under 18, 18 to 64, and 65 and over.

Usage

make_age_group_var(df, dataset, name = "age_group")

Arguments

df

Data frame to add age group variable to.

dataset

Dataset corresponding to df. One of "acs", "cps_asec", or "cps_basic".

name

Name to give age group variable. Defaults to "age_group".

Details

For the ACS, years 2005 to present are supported and the required variable is agep. For the CPS ASEC, survey years 1998 to present are supported and the required variable is a_age. For the basic monthly CPS, years 1998 to present are supported and the required variable is prtage.

Value

A data frame.

Warning

This function is designed to work with original, Census-based ACS or CPS microdata. (As opposed to Census microdata that have been processed by, for example, IPUMS.) Therefore, prior to using this function you should ensure that your data are behaving according to their official data dictionary.


CenterOnBudget/Rcbpp documentation built on Jan. 6, 2025, 9:32 p.m.