saipe: Get SAIPE data

Description Usage Arguments Value Examples

View source: R/saipeAPI.R

Description

Get SAIPE data at various geographic levels.

Usage

1
2
3
4
5
6
7
8
saipe(geo, year = 2010, var = c("NAME", "SAEMHI_PT", "SAEPOVRTALL_PT"),
  api_key = Sys.getenv("saipe_key"))

saipe_us(...)

saipe_state(...)

saipe_county(...)

Arguments

geo

(character) One of "us", "state", and "county".

year

(numeric) A four-digits value or vector of values. Possible values: 1989, 1993, 1995–2014.

var

(character) A string or vector of strings. Possible fields: http://api.census.gov/data/timeseries/poverty/saipe/variables.html

api_key

Use saipeAPI::set_api_key("<Your api here>") to set api_key.

...

Pass parameter year or var for function saipe_us(), saipe_state(), and saipe_county(). Also see Example section.

Value

Return a tibble, i.e., modern data frame. If multiple years are specified, it gives a panel dataset.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
saipeAPI::set_api_key("<Your api here>")

# Get national level median household income and poverty rate in 2014
saipeAPI::saipe(geo = "us", year = 2014, var = c("NAME", "SAEMHI_PT", "SAEPOVRTALL_PT"))

# Or
saipeAPI::saipe_us(year = 2014, var = c("NAME", "SAEMHI_PT", "SAEPOVRTALL_PT"))

# Get 2010--2014 data for natinal level, state-level, and county-level
saipeAPI::saipe_us(year = 2010:2014, var = c("NAME", "SAEMHI_PT", "SAEPOVRTALL_PT"))
saipeAPI::saipe_state(year = 2010:2014, var = c("NAME", "SAEMHI_PT", "SAEPOVRTALL_PT"))
saipeAPI::saipe_county(year = 2010:2014, var = c("NAME", "SAEMHI_PT", "SAEPOVRTALL_PT"))

## End(Not run)

jjchern/saipeAPI documentation built on May 19, 2019, 11:39 a.m.