Read one year of data from the Current Population Survey
Usage
cps_read_year(
file,
cols = cpsvote::cps_cols,
names_col = "new_name",
year = as.numeric(stringr::str_extract(file, "\\d{4}"))
)Arguments
- file
Where the fixed-width or zip/gz file for this year's data lives
- cols
Which columns to read. This must be a data frame, with required columns
start_posandend_pos. The default value iscps_cols, which reads from the listcpsvote::cps_cols. Seevignette("add-variables")for details about how to specify a different set ofcols.- names_col
The column in
colsthat contains column names for the specified columns. If none exists, usenames_col = NULL- year
Which year is being read; defaults to 4-digit year in file name