cps_read {cpsvote} | R Documentation |
Read in CPS data
Description
Load multiple years of data from the Current Population Survey.
This function will also download the data for you, if it is not present in
the given dir
.
Usage
cps_read(
years = seq(1994, 2018, 2),
dir = "cps_data",
cols = cpsvote::cps_cols,
names_col = "new_name",
join_dfs = TRUE
)
Arguments
years |
Which years to read in. Thie function will read data from files
in |
dir |
The folder where the CPS data files live. These files should follow a naming scheme that contains the 4-digit year of the results in question, and have a ".zip" or ".gz" extension. |
cols |
Which columns to read. This must be a data frame, with required
columns |
names_col |
The column in |
join_dfs |
Whether to combine all of the years into a single data frame,
or leave them as a list of data frames. Defaults to |
Value
a data frame, or list of data frames
Examples
## Not run: cps_read(years = 2016, names_col = "new_name")