get_decennial_race: A wrapper function of get_decennial that downloads race data...

Description Usage Arguments Value Examples

View source: R/get_decennial_race.R

Description

get_decennial_race uses the census api to download race & ethnicity data from a specified decennial census. Decennial census tables P0040\*\* P0050\*\* for the 2000 and 2010 census are used respectively. From this table the racial groups White, Black, American Indian or Alaskan Native, Asian, Native Hawaiian or Pacific Islander, some other race, and two or more Races are considered and treated as mutually exclusive categories for individuals who mark Non-Hispanic. Hispanic individuals are designated as Hispanic no matter what they mark for their Racial identifier and are treated as a mutually exclusive racial group for the purposes of the analysis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
get_decennial_race(
  state = NULL,
  county = NULL,
  metro = NULL,
  geography = "tract",
  cache_table = FALSE,
  year = 2010,
  key = NULL,
  as.data.table = TRUE,
  ...
)

Arguments

state

An optional vector of states for which you are requesting data. State names, postal codes, and FIPS codes are accepted. Defaults to NULL.

county

The county for which you are requesting data. County names and FIPS codes are accepted. Must be combined with a value supplied to 'state'. Defaults to NULL.

metro

The cbsa name or fips code. Pulls all counties within a given CBSA. See cbsa_county_df for more info on county to cbsa mapping. Defaults to NULL.

geography

The geography of your data. Defaults to 'tract'.

cache_table

Whether or not to cache table names for faster future access. Defaults to FALSE; if TRUE, only needs to be called once per dataset. If variables dataset is already cached via the load_variables function, this can be bypassed.

year

The year, or endyear, of the census. 1990, 2000, and 2010 are available. Defaults to 2010.

key

Your Census API key. Obtain one at http://api.census.gov/data/key_signup.html

as.data.table

Return output as data table? Deafaults to TRUE.

...

other arguments passed to get_acs

Value

data frame with geography-race specific counts for a given state, county, or CBSA.

Examples

1
2
3
4
5
6
7
# get race data by tract for all of King county Washington
get_decennial_race("WA", "King")

# get race data by block group for all of Seattle metro area for 2000
get_decennial_race(
    metro = "Seattle-Tacoma-Bellevue, WA", geography = "block group",
    year = 2000)

nmmarquez/censeg documentation built on Sept. 12, 2020, 4:13 a.m.