all_census_seg: A wrapper function for get_acs_race and a particular...

Description Usage Arguments Value Examples

View source: R/all_census_seg.R

Description

all_census_seg uses the census api to download race & ethnicity data from a specified 5 year ACS survey from the table "B03002" or the decennial census tables P0040\*\* P0050\*\* for the 2000 and 2010 census respectively. From these tables 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. Then, segregation measures are calculated on the resulting data by either county or metropolitan area across the US 50 states and DC.

Usage

1
2
3
4
5
6
7
8
9
all_census_seg(
  geography = "tract",
  cache_table = FALSE,
  year = 2010,
  key = NULL,
  counties = FALSE,
  seg_func = calc_theilsH,
  ...
)

Arguments

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 ACS sample or Census. 2012 through 2018 are available for ACS and 2000 and 2010 for Census. Defaults to 2010.

key

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

counties

Do analysis of all counties rather than metro areas. Default FALSE.

seg_func

a segregation function from the censeg package. Defaults to 'calc_theilsH'

...

Other parameters to pass to the seg_func.

Value

data frame with geography-race specific counts for all counties or CBSAs.

Examples

1
2
3
4
5
## Not run: 
# Calculate segregation for all CBSAs from the 2010 census
all_census_seg(year = 2010)

## End(Not run)

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