Code demographic variables in responses
code_age_vars.Rd
Given a dataframe of survey responses, look for standard SurveyMonkey demographic questions and code/recode them into new variables that are more banner-, plot-, and analysis-friendly. Use code_std_demo_vars()
to perform all standard demographic recodes, or select the specific function you need. Run std_demo_vars()
to return the full index of SurveyMonkey's standard demographic variables.
Value
Survey data frame with new (or updated) columns corresponding to (if discoverable) respondents' age category and generation:
age
: integer age in yearsage3
: 3-point age categoryage6
: 6-point age categoryage_gen
: 4-point age category corresponding to generation (according to Pew Research Center's now-retired classification)