The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Title: Load CPS Microdata into R Using the 'Census Bureau Data' API
Version: 1.0.0
Description: Load Current Population Survey (CPS) microdata into R using the 'Census Bureau Data' API (https://www.census.gov/data/developers/data-sets.html), including basic monthly CPS and CPS ASEC microdata.
URL: https://github.com/matt-saenz/cpsR
BugReports: https://github.com/matt-saenz/cpsR/issues
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.3
Imports: httr, jsonlite, tibble
NeedsCompilation: no
Packaged: 2023-09-09 01:21:52 UTC; mattsaenz
Author: Matt Saenz [aut, cre]
Maintainer: Matt Saenz <mattsaenz165@gmail.com>
Repository: CRAN
Date/Publication: 2023-09-09 06:50:02 UTC

Load CPS ASEC microdata

Description

get_asec() loads CPS ASEC microdata using the Census API.

Usage

get_asec(
  year,
  vars,
  key = get_key(),
  show_url = FALSE,
  tibble = TRUE,
  convert = TRUE
)

Arguments

year

Year of data to retrieve. Years 1992 and on are currently supported.

vars

Character vector of variables to retrieve, where each vector element corresponds to the name of a single variable. Variable names can be given in uppercase or lowercase but are always made lowercase in the returned data.

key

Census API key. Defaults to environment variable CENSUS_API_KEY. See the README for info on how (and why) to set up env var CENSUS_API_KEY.

show_url

If TRUE, show the URL the request was sent to (with key suppressed). Defaults to FALSE.

tibble

If TRUE (default), return data as a tibble. If FALSE, return data as a base data frame.

convert

If TRUE (default), run type.convert() with as.is = TRUE on the data returned by the Census API. If FALSE, all columns in the returned data will be character vectors (exactly as returned by the Census API).

Value

A tibble or base data frame.

Examples

## Not run: 
asec21 <- get_asec(2021, vars = c("marsupwt", "spm_poor"))

## End(Not run)


Load basic monthly CPS microdata

Description

get_basic() loads basic monthly CPS microdata using the Census API.

Usage

get_basic(
  year,
  month,
  vars,
  key = get_key(),
  show_url = FALSE,
  tibble = TRUE,
  convert = TRUE
)

Arguments

year

Year of data to retrieve. Years 1989 and on are currently supported.

month

Month of data to retrieve (specified as a number).

vars

Character vector of variables to retrieve, where each vector element corresponds to the name of a single variable. Variable names can be given in uppercase or lowercase but are always made lowercase in the returned data.

key

Census API key. Defaults to environment variable CENSUS_API_KEY. See the README for info on how (and why) to set up env var CENSUS_API_KEY.

show_url

If TRUE, show the URL the request was sent to (with key suppressed). Defaults to FALSE.

tibble

If TRUE (default), return data as a tibble. If FALSE, return data as a base data frame.

convert

If TRUE (default), run type.convert() with as.is = TRUE on the data returned by the Census API. If FALSE, all columns in the returned data will be character vectors (exactly as returned by the Census API).

Value

A tibble or base data frame.

Examples

## Not run: 
sep21 <- get_basic(
  year = 2021,
  month = 9,
  vars = c("pwcmpwgt", "prpertyp", "prtage", "pemlr")
)

## End(Not run)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.