load.pums: Load ACS PUMS csv files in a ready-to-use form.

Description Usage Arguments Details Value

View source: R/load.pums.R

Description

Load the ACS PUMS data from a csv file with the data types set correctly. Most fields in the ACS data are simple integers, but a few are not. See the details section for specifics.

Usage

1
load.pums(path)

Arguments

path

path to a csv file with ACS PUMS housing or population data.

Details

Most fields in the ACS PUMS data are either integer-coded categoricals or counts, but there are exceptions, and the exceptions vary by year and span (1 year or 5 year data). This function loads most fields as integers and handles the exceptions correctly. The exceptions are:

1. RT, the record type, is 'H' in housing records and 'P' in person records. For any given file, it is constant so it is dropped.

2. SERIALNO, is loaded as a string because it overflows on 5-year data as an integer. It is only used for joining person records to housing records so this is fine.

3. Inflation factors. In older data, this is just ADJUST. In recent years, housing data has ADJINC and ADJHSG, and person records have just ADJINC. In any case, they are 7-digit integers equal to the inflation factor times 1e6. This function returns them as floats after multiplication by 1e-6.

4. NAICSP is an occupation code. It is quasi-numeric with a few values like "33641M1". It is returned as a character column.

5. SOCP or SOCP10 and SOCP12. These are quasi-numeric occupation codes like NAICSP. They have a few values like "4750XX". In 1-year files and some 5-year files, SOCP is present. In other files both SOCP10 and SOCP12 are present. In either case, they are returned as character columns.

6. OCCP or OCCP10 and OCCP12 are occupation codes. OCCP10 and OCCP12 are nearly numeric; they include two NA values, one for not in labor force and the other indicates that the code for that row is under the other system. They are loaded as character columns to preserve that information. OCCP can load as numeric, but it is loaded as character for consistency with OCCP10 and OCCP12.

Value

data frame with ACS PUMS housing or population data from a csv file


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