acs.recode: Rewrite variable levels using data dictionary

Description Usage Arguments Value Examples

View source: R/acs.recode.R

Description

In the ACS PUMS data, many fields are integer-coded categoricals. There is a data dictionary (a text document) that describes the mapping from integers to level definitions. Function acs.recode takes the data dicitonary as a string and uses it to construct a factor variable that recodes integer levels to the text definitions given in the data dictionary.

Usage

1
acs.recode(x, field, dd, max.len = NULL)

Arguments

x

ACS PUMS data frame

field

column name for a variable in the ACS PUMS data

dd

the ACS data dictionary loaded as a string

max.len

max length of description in characters, default is all

Value

factor column with integer levels in x[field] replaced with the desciption for that level from the data dictionary.

Examples

1
2
wa.pop16$employment <- acs.recode(wa.pop16, 'ESR', data.dict16, max.len=40)
group.count(wa.pop16, 'employment')

davidthaler/PUMSutils documentation built on July 13, 2019, 9:58 a.m.