Package 'totalcensus'

Title: Extract Decennial Census and American Community Survey Data
Description: Download summary files from Census Bureau <https://www2.census.gov/> and extract data, in particular high resolution data at block, block group, and tract level, from decennial census and American Community Survey 1-year and 5-year estimates.
Authors: Guanglai Li
Maintainer: Guanglai Li <[email protected]>
License: MIT + file LICENSE
Version: 0.6.7
Built: 2024-11-09 04:53:06 UTC
Source: https://github.com/gl-li/totalcensus

Help Index


convert fips codes to names of a geographies

Description

convert fips codes to names of a geographies

Usage

convert_fips_to_names(
  FIPs,
  states = NULL,
  geo_header = "STATE",
  in_states = NULL
)

Arguments

FIPs

string vector of fips code such as c("021", "002")

states

string vector of state abbreviations having same length as FIPs

geo_header

string, taking values of "STATE", "COUNTY", "PLACE", "COUSUB" or "CBSA".

in_states

which states are these FIPs generated from. Use state abbrevations or "US" for national. Vector of unique states.

Value

vector of names corresponding to FIPs and states

Examples

aaa <- convert_fips_to_names(c("11", "44"))
# [1] "DC" "RI"

bbb <- convert_fips_to_names(c("001", "013"), states = c("RI", "MA"), geo_header = "COUNTY")
# [1] "Bristol County" "Hampden County"

List of geographic headers used in 2005 ACS 1 year survey

Description

List of geographic headers used in 2005 ACS 1 year survey

Usage

dict_acs_geoheader_2005_1year

Format

A data.table with 35 rows and 4 variables

reference

reference of the geoheader

field

description of the geoheader

start

starting position of the geoheader in geography file

end

ending position of the geoheader in geography file

Source

2005 ACS Summary File technical documentation, page 12.


List of geographic headers used in 2006 - 2008 ACS 1 year survey

Description

List of geographic headers used in 2006 - 2008 ACS 1 year survey

Usage

dict_acs_geoheader_2006_2008_1year

Format

A data.table with 51 rows and 4 variables

reference

reference of the geoheader

field

description of the geoheader

start

starting position of the geoheader in geography file

end

ending position of the geoheader in geography file

Source

2008 ACS Summary File technical documentation, page 13.


List of geographic headers in 2009 ACS 1 year survey

Description

List of geographic headers in 2009 ACS 1 year survey

Usage

dict_acs_geoheader_2009_1year

Format

A data.table with 50 rows and 4 variables

reference

reference of the geoheader

field

description of the geoheader

start

starting position of the geoheader in geography file

end

ending position of the geoheader in geography file

Source

2016 ACS Summary File technical documentation, page 11.


List of geographic headers used in ACS 5 year survey ending 2009

Description

List of geographic headers used in ACS 5 year survey ending 2009

Usage

dict_acs_geoheader_2009_5year

Format

A data.table with 51 rows and 4 variables

reference

reference of the geoheader

field

description of the geoheader

start

starting position of the geoheader in geography file

end

ending position of the geoheader in geography file

Source

2009 ACS Summary File technical documentation, page 12.


List of geographic headers used in 2010 ACS 1 and 5 year surveys

Description

List of geographic headers used in 2010 ACS 1 and 5 year surveys

Usage

dict_acs_geoheader_2010

Format

A data.table with 53 rows and 4 variables

reference

reference of the geoheader

field

description of the geoheader

start

starting position of the geoheader in geography file

end

ending position of the geoheader in geography file

Source

2016 ACS Summary File technical documentation, page 11.


List of geographic headers used in American Community Survey since 2011

Description

List of geographic headers used in American Community Survey since 2011

Usage

dict_acs_geoheader_2011_now

Format

A data.table with 53 rows and 4 variables

reference

reference of the geoheader

field

description of the geoheader

start

starting position of the geoheader in geography file

end

ending position of the geoheader in geography file

Source

2016 ACS Summary File technical documentation, page 10.


List of geographic components used in ACS 1 year surverys

Description

List of geographic components used in ACS 1 year surverys

Usage

dict_acs1_geocomponent

Format

A data.table with 28 rows and 9 variables:

code

code for the geocomponent, such as "01" and "M3"

geo_component

description of the geographic component

state_2009_to_now

wheather a geocomponent available in state files since 2009

state_2007_2008

wheather a geocomponent available in state files in 2007 and 2008

state_2005_2006

wheather a geocomponent available in state files in 2005 and 2006

US_2009_to_now

wheather a geocomponent available in national files since 2009

US_2007_2008

wheather a geocomponent available in national files in 2007 and 2008

US_2006

wheather a geocomponent available in national files in 2006

US_2005

wheather a geocomponent available in national files in 2005


List of summary levels used in ACS 1 year surverys

Description

List of summary levels used in ACS 1 year surverys

Usage

dict_acs1_summarylevel

Format

A data.table with 23 rows and 5 variables

code

code of summary level

summary_level

description of summary level

state_2006_to_now

wheather a summary level available in state files since 2006

state_2005

wheather a summary level available in state files in 2005

US_2005_to_now

wheather a summary level available in national files since 2005


List of summary levels used in ACS 1 year surverys

Description

List of summary levels used in ACS 1 year surverys

Usage

dict_acs1_table

Format

A data.table with 1811 rows and 16 variables:

table_number

table number such as "C27013"

table_name

description of the table

acs1_2019

whether the table is available in 2019

acs1_2018

whether the table is available in 2018

acs1_2017

whether the table is available in 2017

acs1_2016

whether the table is available in 2016

acs1_2015

whether the table is available in 2015

acs1_2014

whether the table is available in 2014

acs1_2013

whether the table is available in 2013

acs1_2012

whether the table is available in 2012

acs1_2011

whether the table is available in 2011

acs1_2010

whether the table is available in 2010

acs1_2009

whether the table is available in 2009

acs1_2008

whether the table is available in 2008

acs1_2007

whether the table is available in 2007

acs1_2006

whether the table is available in 2006

acs1_2005

whether the table is available in 2005

universe

universe of the table


List of geographic components used in ACS 5 year surverys

Description

List of geographic components used in ACS 5 year surverys

Usage

dict_acs5_geocomponent

Format

A data.table with 19 rows and 4 variables:

code

code for the geocomponent, such as "01" and "M3"

geo_component

description of the geographic component

state_2009_to_now

wheather a geocomponent available in state files since 2009

US_2009_to_now

wheather a geocomponent available in national files since 2009


List of summary levels used in ACS 5 year surveys

Description

List of summary levels used in ACS 5 year surveys

Usage

dict_acs5_summarylevel

Format

A data.table with 87 rows and 8 variables

code

code of summary level

summary_level

description of summary level

state_2013_to_now

wheather a summary level available in state files since 2013

state_2012

wheather a summary level available in state files in 2012

state_2009_to_2011

wheather a summary level available in state files in 2009 - 2011

US_2011_to_now

wheather a summary level available in national files since 2011

US_2010

wheather a summary level available in national files in 2010

US_2009

wheather a summary level available in national files in 2009

Source

generated from lookup datasets of years 2009 - 2016


List of summary levels used in ACS 5 year surverys

Description

List of summary levels used in ACS 5 year surverys

Usage

dict_acs5_table

Format

A data.table with 1174 rows and 14 variables:

table_number

table number such as "C27013"

table_name

description of the table

acs5_2021

whether the table is available in 2021

acs5_2020

whether the table is available in 2020

acs5_2019

whether the table is available in 2019

acs5_2018

whether the table is available in 2018

acs5_2017

whether the table is available in 2017

acs5_2016

whether the table is available in 2016

acs5_2015

whether the table is available in 2015

acs5_2014

whether the table is available in 2014

acs5_2013

whether the table is available in 2013

acs5_2012

whether the table is available in 2012

acs5_2011

whether the table is available in 2011

acs5_2010

whether the table is available in 2010

acs5_2009

whether the table is available in 2009

universe

universe of the table


List of all geographic components, 2000 version

Description

This dataset contains all available geographic components and codes.

Usage

dict_all_geocomponent_2000

dict_all_geocomponent_2000

Format

A data.table with 99 rows and 2 variables:

code

code for the geocomponent, such as "01" and "M3"

geo_component

description of the geographic component

A data.table with 99 rows and 2 variables:

code

code for the geocomponent, such as "01" and "M3"

geo_component

description of the geographic component

Source

2000 Census Summary File 1 technical documentation page 7-15


List of all geographic components, 2010 version

Description

This dataset contains all available geographic components and codes.

Usage

dict_all_geocomponent_2010

dict_all_geocomponent_2010

Format

A data.table with 114 rows and 2 variables:

code

code for the geocomponent, such as "01" and "M3"

geo_component

description of the geographic component

A data.table with 114 rows and 2 variables:

code

code for the geocomponent, such as "01" and "M3"

geo_component

description of the geographic component

Source

2010 Census Summary File 1 technical documentation page 6-15


List of all summary levels

Description

List of all summary levels

Usage

dict_all_summarylevel

Format

A data.table with 216 rows and 2 variables

code

code of summary level

summary_level

description of summary level

Source

Summary level code list


List CBSA code of Metropolitan Statistical Area/Micropolitan Statistical Area

Description

This dataset contains Metropolitan Statistical Area/Micropolitan Statistical Area CBSA code and title, plus associated metrodivision, CSA, state, and county code. Search for CBSA with function search_cbsa.

Usage

data("dict_cbsa")

Format

A data.table with 1882 rows and 12 variables:

CBSA

CBSA code

CBSA_title

CBSA title

state_full

full name of the state. A cbsa could include multiple states

county

county or county equivalent

CSA

code of the CSA to which the CBSA belongs

CSA_title

CSA title

METDIV

metro division code

METDIV_title

metro division title

metro_micro

is the CBSA a metropolitan or a micropolitan statistic area

STATE

FIPS of the state

COUNTY

FIPS of the county

central_outlying

is the counry a central or outlying county in the CBSA

Source

List of CBSA


List of geographic components and codes in census 2000

Description

This dataset contains the geographic components and codes used in Census 2000 summary file 1. Search geographic components with function search_geocomponents.

Usage

dict_decennial_geocomponent_2000

Format

A data.table with 98 rows and 4 variables:

code

code for the geocomponent, such as "01" and "M3"

geo_component

description of the geographic component

state_file

wheather the geocomponent available in state files

US_file

wheather the geocomponent available in national files

Source

2000 Census Summary File 1 technical documentation page 7-15


List of geographic components and codes in census 2010

Description

This dataset contains the geographic components and codes used in Census 2010 summary file 1 (with urban/rural update). Search geographic components with function search_geocomponents.

Usage

dict_decennial_geocomponent_2010

Format

A data.table with 96 rows and 4 variables:

code

code for the geocomponent, such as "01" and "M3"

geo_component

description of the geographic component

state_file

wheather the geocomponent available in state files

US_file

wheather the geocomponent available in national files

Source

2010 Census Summary File 1 technical documentation page 6-15


List of geographic headers in census 2000

Description

This dataset has the complete list of geographic header references and their discription used in Census 2000 summary file 1. Search the dataset with function search_geoheaders.

Usage

dict_decennial_geoheader_2000

Format

A data.table with 83 rows and 4 variables

reference

reference of the geoheader record

field

description of the geoheader record field

start

starting position of the geoheader in the record

end

ending position of the geoheader in the record

Source

2000 Census Summary File 1 technical documentation page 2-7


List of geographic headers in census 2010

Description

This dataset has the complete list of geographic header references and their discription used in Census 2010 summary file 1 (with urban/rural update). Search the dataset with function search_geoheaders.

Usage

dict_decennial_geoheader_2010

Format

A data.table with 101 rows and 4 variables

reference

reference of the geoheader record

field

description of the geoheader record field

start

starting position of the geoheader in the record

end

ending position of the geoheader in the record

Source

2010 Census Summary File 1 technical documentation page 2-8


Summary levels available in Census 2000

Description

This data contains summary levels and codes used in census 2000 summary file 1. Search with function search_summarylevels.

Usage

dict_decennial_summarylevel_2000

Format

A data.table with 114 rows and 4 variables

code

code of summary level

summary_level

description of summary level

in_state_file

wheather the summary level available in state files

in_US_file

wheather the summary level available in national files

Source

2000 Census Summary File 1 technical documentation page 4-1.


Summary levels available in Census 2010

Description

This data contains summary levels and codes used in census 2010 summary file 1 (with urban/rural update). Search with function search_summarylevels.

Usage

dict_decennial_summarylevel_2010

Format

A data.table with 165 rows and 4 variables

code

code of summary level

summary_level

description of summary level

in_state_file

wheather the summary level available in state files

in_US_file

wheather the summary level available in national files

Source

2010 Census Summary File 1 technical documentation page 4-16 state summary file with urban/rural update


Complete list of 2000 census tables

Description

This dataset contains all census tables in census 2000 summary file 1.

Usage

dict_decennial_table_2000

Format

A data.table with 286 rows and 4 variables:

table_number

table number such as "H1", "PCT22G"

table_name

description of the table

universe

universe of the data

table_ref

reference code such as "H0010", "PCT022G"

Source

2000 Census Summary File 1 technical documentation all across chapter 5.


Complete list of 2010 census tables

Description

This dataset contains all census tables in census 2010 summary file 1 (with urban/rural update).

Usage

dict_decennial_table_2010

Format

A data.table with 333 rows and 4 variables:

table_number

table number such as "H1", "PCT22G"

table_name

description of the table

universe

universe of the data

table_ref

reference code such as "H0010", "PCT022G"

Source

2010 Census Summary File 1 technical documentation chapter 5.


List of FIPS code as of 2016 in the US

Description

This dataset contains a list of FIPS of states, counties, county subdivisions, places, consolidated cities, and their names and summary levels as well as full name and abbreviation of state. It does NOT contain FIPS of many small areas. Search for FIPS with function search_fips.

Usage

data("dict_fips")

Format

A data.table with 43934 rows and 9 variables:

state_full

full name of a state such as "Alabama"

state_abbr

abbreviation of a state such as "AL"

STATE

FIPS code of the state

SUMLEV

summary level of the entry in the row

COUNTY

FIPS code of county

CUSUB

FIPS of COUnty SUBdivision

PLACE

FIPS code of place

CONCIT

FIPS code of CONsolidated CITy

NAME

name of the entry in the row

Source

List of FIPS as of 2016


download census data

Description

Download decennial census and ACS 5-year and 1-year data from United States Census bureau. It also download generated data from Census 2010 if not exist.

Usage

download_census(survey, year, states = c(states_DC, "US", "PR"))

Arguments

survey

Which survey to download from, "decennial", "acs5year", , "acs1year", or "redistricting".

year

year or ending year of the survey

states

vector of abbreviations of states such as c("MA", "RI")


Download data generated from Census 2010

Description

This function downloads data generated from Census 2010 from Census 2010.

Usage

download_generated_data()

ACS 1-year 2005 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2005

Format

A data.table with 27246 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0166"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2006 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2006

Format

A data.table with 27986 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0166"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2007 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2007

Format

A data.table with 29709 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0166"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2008 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2008

Format

A data.table with 34403 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0166"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2009 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2009

Format

A data.table with 34408 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0166"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2010 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2010

Format

A data.table with 35240 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0166"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2011 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2011

Format

A data.table with 34454 rows and 6 variables

file_segment

sequence number of segment data files, from "0001" to "0165"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2012 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2012

Format

A data.table with 34394 rows and 6 variables

file_segment

sequence number of segment data files, from "0001" to "0165"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2013 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2013

Format

A data.table with 32752 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0165"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2014 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2014

Format

A data.table with 31711 rows and 6 variables

file_segment

sequence number of segment data files, from "0001" to "0165"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2015 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2015

Format

A data.table with 31751 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0165"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2016 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2016

Format

A data.table with 31835 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0166"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2017 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2017

Format

A data.table with 33749 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0166"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2018 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2018

Format

A data.table with 35502 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0166"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 1-year 2019 file segment and table lookup data

Description

There is slightly difference in the lookup tables of each year.

Usage

lookup_acs1year_2019

Format

A data.table with 35527 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0166"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2009 file segment and table lookup data

Description

ACS 5-year 2009 file segment and table lookup data

Usage

lookup_acs5year_2009

Format

A data.table with 21207 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2010 file segment and table lookup data

Description

ACS 5-year 2010 file segment and table lookup data

Usage

lookup_acs5year_2010

Format

A data.table with 21487 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2011 file segment and table lookup data

Description

ACS 5-year 2011 file segment and table lookup data

Usage

lookup_acs5year_2011

Format

A data.table with 21038 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2012 file segment and table lookup data

Description

ACS 5-year 2012 file segment and table lookup data

Usage

lookup_acs5year_2012

Format

A data.table with 22527 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2013 file segment and table lookup data

Description

ACS 5-year 2013 file segment and table lookup data

Usage

lookup_acs5year_2013

Format

A data.table with 22711 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2014 file segment and table lookup data

Description

ACS 5-year 2014 file segment and table lookup data

Usage

lookup_acs5year_2014

Format

A data.table with 22627 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2015 file segment and table lookup data

Description

ACS 5-year 2015 file segment and table lookup data

Usage

lookup_acs5year_2015

Format

A data.table with 22910 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2016 file segment and table lookup data

Description

ACS 5-year 2016 file segment and table lookup data

Usage

lookup_acs5year_2016

Format

A data.table with 22958 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2017 file segment and table lookup data

Description

ACS 5-year 2017 file segment and table lookup data

Usage

lookup_acs5year_2017

Format

A data.table with 25070 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2018 file segment and table lookup data

Description

ACS 5-year 2018 file segment and table lookup data

Usage

lookup_acs5year_2018

Format

A data.table with 26996 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2019 file segment and table lookup data

Description

ACS 5-year 2019 file segment and table lookup data

Usage

lookup_acs5year_2019

Format

A data.table with 27039 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2020 file segment and table lookup data

Description

ACS 5-year 2020 file segment and table lookup data

Usage

lookup_acs5year_2020

Format

A data.table with 27850 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


ACS 5-year 2021 file segment and table lookup data

Description

ACS 5-year 2021 file segment and table lookup data

Usage

lookup_acs5year_2021

Format

A data.table with 27886 rows and 7 variables

file_segment

sequence number of segment data files, from "0001" to "0122"

table_content

description of columns in a table

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

restriction

restrictions applied the the table_content

table_number

table number such as "B01001"

table_name

description of table. A table has multiple columns (table_content)

universe

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.


Lookup data files and table contents of Census 2000

Description

This dataset includes all data fields of data files in census 2000 summary file 1. Fucntion search_tablecontents searches content in this dataset.

Usage

lookup_decennial_2000

Format

A data.table with 8321 rows and 6 variables:

file_segment

sequence number of segment data files, from 1 to 48

table_content

description of columns in a decennial table

reference

reference of table content, such as "PCT0240019"

table_number

table number such as "H1", "PCT22G"

table_name

description of table, which has many table_content

universe

the universe of the decennial data

Source

2000 Census Summary File 1 technical documentation chapter 7.


Lookup data files and table contents of Census 2010

Description

This dataset includes all data fields of data files in census 2010 summary file 1 (with urban/rural update). Fucntion search_tablecontents searches content in this dataset.

Usage

lookup_decennial_2010

Format

A data.table with 9199 rows and 6 variables:

file_segment

sequence number of segment data files, from 1 to 48

table_content

description of columns in a decennial table

reference

reference of table content, such as "PCT0240019"

table_number

table number such as "H1", "PCT22G"

table_name

description of table, which has many table_content

universe

the universe of the decennial data

Source

2010 Census Summary File 1 technical documentation chapter 6.


Read summary file 1 of ACS 1-year estimates

Description

This function retrieves data from summary file of ACS 1-year estimates. In addition to selected geographic headers and table contents, it also returns total population and coordinates of selected geographic areas, as well as summary levels and geographic components.

Usage

read_acs1year(
  year,
  states,
  table_contents = NULL,
  areas = NULL,
  geo_headers = NULL,
  summary_level = NULL,
  geo_comp = "total",
  with_margin = FALSE,
  dec_fill = NULL,
  show_progress = TRUE
)

Arguments

year

year of the estimate

states

vector of state abbreviations, such as "IN" and c("MA", "RI").

table_contents

selected references of contents in census tables. Users can choose a name for each reference, such as in c("abc = B01001_009", "fff = B00001_001"). Try to make names meaningful. To find the references of table contents of interest, search with function search_tablecontents.

areas

For metro area, in the format like "New York metro". For county, city, or town, must use the exact name as those in dict_fips in the format like "kent county, RI", "Boston city, MA", and "Lincoln town, RI". And special examples like "Salt Lake City city, UT" must keep the "city" after "City".

geo_headers

vector of references of selected geographci headers to be included in the return. Search with search_geoheaders

summary_level

select which summary level to keep, default to keep all. It takes strings including "state", "county", "county subdivision", "place", "tract", "block group", and "block" for the most common levels. It also take code. Search all codes with search_summarylevels.

geo_comp

select which geographic component to keep, "*" to keep every geo-component, "total" for "00", "urban" for "01", "urbanized area" for "04", "urban cluster" for "28", "rural" for "43". Others should input code, which can be found with function search_geocomponents. Availability of geocomponent depends on summary level.

with_margin

read also margin of error in addition to estimate

dec_fill

whether to fill geo_headers codes with data from decennial census. The #' codes in ACS summary file are incomplete. "dec2010" using decennial census 2010 data.

show_progress

whether to show progress in fread()

Value

A data.table of selected data.

Examples

## Not run: 
# read summary data using areas of selected cities
aaa <- read_acs1year(
    year = 2016,
    states = c("UT", "RI"),
    table_contents = c("male = B01001_002", "female = B01001_026"),
    areas = c("Salt Lake City city, UT",
              "Providence city, RI",
              "PLACE = RI19180"),
    summary_level = "place",
    with_margin = TRUE
)


# read data using geoheaders - all major counties
bbb <- read_acs1year(
    year = 2015,
    states = c("UT", "RI"),
    table_contents = c("male = B01001_002", "female = B01001_026"),
    geo_headers = c("COUNTY"),
    summary_level = "county",
    with_margin = TRUE
)

## End(Not run)

Read ACS 5-year estimates

Description

This function retrieves data from summary file of ACS 5-year estimates. In addition to selected geographic headers and table contents, it also returns total population and coordinates of selected geographic areas, as well as summary levels and geographic components.

Usage

read_acs5year(
  year,
  states,
  table_contents = NULL,
  areas = NULL,
  geo_headers = NULL,
  summary_level = NULL,
  geo_comp = "total",
  with_margin = FALSE,
  dec_fill = NULL,
  show_progress = TRUE
)

Arguments

year

ending year of the 5-year estimate

states

vector of state abbreviations, such as "IN" and c("MA", "RI").

table_contents

selected references of contents in census tables. Users can choose a name for each reference, such as in c("abc = B01001_009", "fff = B00001_001"). Try to make names meaningful. To find the references of table contents of interest, search with function search_tablecontents.

areas

For metro area, in the format like "New York metro". For county, city, or town, must use the exact name as those in dict_fips in the format like "kent county, RI", "Boston city, MA", and "Lincoln town, RI". And special examples like "Salt Lake City city, UT" must keep the "city" after "City".

geo_headers

vector of references of selected geographci headers to be included in the return, like "COUNTY" or c("PLACE", "CBSA"). Search with search_geoheaders

summary_level

select which summary level to keep, default to keep all. It takes string including "state", "county", "county subdivision", "place", "tract", "block group", and "block" for the most common levels. It also take code. Search all codes with search_summarylevels.

geo_comp

select which geographic component to keep, "*" to keep every geo-component, "total" for "00", "urban" for "01", "urbanized area" for "04", "urban cluster" for "28", "rural" for "43". Others should input code, which can be found with function search_geocomponents. Availability of geocomponent depends on summary level.

with_margin

read also margin of error in addition to estimate

dec_fill

whether to fill geo_headers codes with data from decennial census. The codes in ACS summary file are incomplete. "dec2010" using decennial census 2010 data

show_progress

whether to show progress in fread()

Value

A data.table of selected data.

Examples

## Not run: 
# read data using areas
aaa <- read_acs5year(
    year = 2015,
    states = c("UT", "RI"),
    table_contents = c(
        "white = B02001_002",
        "black = B02001_003",
        "asian = B02001_005"
    ),
    areas = c(
        "Lincoln town, RI",
        "Salt Lake City city, UT",
        "Salt Lake City metro",
        "Kent county, RI",
        "COUNTY = UT001",
        "PLACE = UT62360"
    ),
    summary_level = "block group",
    with_margin = TRUE
)


# read data using geoheaders
bbb <- read_acs5year(
    year = 2015,
    states = c("UT", "RI"),
    table_contents = c("male = B01001_002", "female = B01001_026"),
    geo_headers = "PLACE",
    summary_level = "block group"
)

## End(Not run)

Read decennial census data

Description

This function retrieves data from summary file 1 (with urban/rural update) of decennial censuses. In addition to selected geographic headers and table contents, it also returns total population and coordinates of selected geographic areas, as well as summary levels and geographic components.

Usage

read_decennial(
  year,
  states,
  table_contents = NULL,
  areas = NULL,
  geo_headers = NULL,
  summary_level = NULL,
  geo_comp = "total",
  show_progress = TRUE
)

Arguments

year

year of the decennial census

states

vector of state abbreviations, for example "IN" or c("MA", "RI").

table_contents

selected references of contents in census tables. Users can choose a name for each reference, such as in c("abc = PCT012F139", "fff = P0030008", "rural_p = P0020005"). Try to make names meaningful. To find the references of table contents of interest, search with function search_tablecontents.

areas

For metro area, in the format like "New York metro". For county, city, or town, must use the exact name as those in dict_fips in the format like "kent county, RI", "Boston city, MA", and "Lincoln town, RI". And special examples like "Salt Lake City city, UT" must keep the "city" after "City".

geo_headers

vector of references of selected geographci headers to be included in the return. Search with search_geoheaders

summary_level

select which summary level to keep, default to keep all. It takes strings including "state", "county", "county subdivision", "place", "tract", "block group", and "block" for the most common levels. It also take code for level. Search all codes with search_summarylevels.

geo_comp

select which geographic component to keep, "*" to keep every geo-component, "total" for "00", "urban" for "01", "urbanized area" for "04", "urban cluster" for "28", "rural" for "43". For all other geographic component, use code, which can be found with search_geocomponents. Availability of geocomponent depends on summary level. State level contains all geographic component. County subdivision and higher level have "00", "01", and "43". Census tract and lower level have only "00".

show_progress

show progress of file reading if TRUE. Turn off if FALSE, which is useful in RMarkdown output.

Value

A data.table whose columns include the selected geoheaders and table contents plus SUMLEV, GEOCOMP, and state.

Examples

## Not run: 
# read one table and one area from one state
aaa = read_decennial(
    year = 2010,
    states = "UT",
    table_contents = c("urban = P0020002", "rural = P0020005"),
    geo_headers = "CBSA",
    summary_level = "tract"
)


# read multiple table contents and areas from multiple states
bbb = read_decennial(
    year = 2010,
    states = c("UT", "RI"),
    table_contents = c("urban = P0020002", "rural = P0020005"),
    areas = c(
        "place = ut62360",
        "Providence city, RI",
        "cousub = ri41500",
        "cbsa = 39300"
    ),
    summary_level = "block"
)


# read table contents of all county subdivisions in Providence metro
ccc <- read_decennial(
    year = 2010,
    states = "US",
    table_contents = c("urban = P0020002", "rural = P0020005"),
    geo_headers = "CBSA",
    summary_level = "county subdivision",
    geo_comp = "*"
)

## End(Not run)

Search Core Based Statistical Area (CBSA)

Description

Search CBSA code of Core Based Statistical Area in dataset dict_cbsa. The search also returns which CSA (Combined Statistical Area) that contains the CBSA. If the CBSA contains multiple counties, each county is returned as a row.

Usage

search_cbsa(keywords = NULL, view = TRUE)

Arguments

keywords

keywords to be searched.

view

display the search result with View if TRUE.

Details

Quite often, multiple rows are returned. It is necessary to hand pick the right one you are really looking for.

Value

A data.table

Examples

# Change view = TRUE (default) to View the returned data.
aaa <- search_cbsa("providence", view = FALSE)

bbb <- search_cbsa("new york", view = FALSE)

## Not run: 
  # view all CBSA code
  search_cbsa()

## End(Not run)

Search FIPS Codes

Description

Search FIPS code of a states, counties, county subdivisions, places, or consolidated cities in dataset dict_fips. The search also returns summary levels.

Usage

search_fips(keywords = NULL, state = NULL, view = TRUE)

Arguments

keywords

keyword to be searched in NAMES or FIPS.

state

abbreviation of a state.

view

display the search result with View if TRUE.

Details

Quite often, multiple rows are returned. It is necessary to hand pick the right one you are really looking for.

The function search_fips has changed summary level 061 to 060, and 162 to 160 in search results. The summary levels in dict_fips are 010, 040, 050, 061, 162, and 170. The level 061 is for Minor Civil Division (MCD)/Census County Division (CCD) (10,000+). It does not appear in those used in decennial census and ACS surveys, which instead have 060 for County Subdivision. Level 061 is part of 060 and is replaced with 060 in order to use the census data. Similarly, 162 is replaced with 160.

Value

A data.table

Examples

# Change view = TRUE (default) to View the returned data.table.

# Search fips of Lincoln in Rhode Island.
aaa <- search_fips("lincoln", "RI", view = FALSE)

# search FIPS number in all states
bbb <- search_fips("08375", view = FALSE)

## Not run: 
  # view all fips code
  search_fips()

## End(Not run)

Search Geographic Components

Description

Search the code or content of geographic components for geo_comp argument in function read_decennial, read_acs1year, and read_acs5year.

Usage

search_geocomponents(survey, years = NULL, keywords = NULL, view = TRUE)

Arguments

survey

survey type, including "dec" (or "decennial"), "acs1" or "acs5".

years

year or ending year of the survey, can be a single year such as 2010 or a vector like 2014:2016.

keywords

keyword to search in code or description, in the form like "abc def dsdfsa". Rows with all words are returned.

view

display the search result with View if TRUE

Details

The most frequently used geographic components are:

00 : all geographic component 01 : urban 43 : rural

Value

A data.table

Examples

# Change view = TRUE (default) to View the returned data.
aaa <- search_geocomponents("decennial", 2010, "urban", view = FALSE)
bbb <- search_geocomponents("acs5", 2011:2015, "43", view = FALSE)

## Not run: 
  # view all geocomponents
  search_geocomponents("dec")
  search_geocomponents("acs5")

## End(Not run)

Search Geographic Headers

Description

Search in field reference or description of geographic header records to find the reference of "geo_headers" argument in function read_decennial, read_acs1year, and read_acs5year.

Usage

search_geoheaders(survey, years = NULL, keywords = NULL, view = TRUE)

Arguments

survey

survey type, including "dec" (or "decennial"), "acs1" or "acs5".

years

year or ending year of the survey, can be a single year such as 2010 or a vector like 2014:2016.

keywords

keyword to search in code or description, in the form like "abc def dsdfsa". Rows with all words are returned.

view

display the search result with View if TRUE

Value

data.table matching the search criteria

Examples

# Change view = TRUE (default) to View the returned data.
# search geoheader that contains keyword "india" in decennial 2010
aaa <- search_geoheaders("decennial", 2000, "india", view = FALSE)

# search for lattitude
bbb <- search_geoheaders("dec", 2010, "latitu", view = FALSE)


## Not run: 
  # browse all geoheaders in ACS i year in View()
  search_geoheaders("acs1")

## End(Not run)

Search Summary Levels

Description

Search code or description of summary levels for summary_level argument in function read_decennial, read_acs1year, and read_acs5year.

Usage

search_summarylevels(survey, years = NULL, keywords = NULL, view = TRUE)

Arguments

survey

survey type, including "dec" (or "decennial"), "acs1" or "acs5".

years

year or ending year of the survey, can be a single year such as 2010 or a vector like 2014:2016.

keywords

keyword to search in code or description, in the form like "abc def dsdfsa". Rows with all words are returned.

view

display the search result with View if TRUE

Value

A data.table of searched results.

Examples

# Change view = TRUE (default) to View the returned data.
aaa = search_summarylevels("decennial", 2010, "block", view = FALSE)
bbb <- search_summarylevels("acs5", 2009:2010, "40", view = FALSE)

## Not run: 
  # view all summary levels
  search_summarylevels("decennial")
  search_summarylevels("acs1")

## End(Not run)

Search Table Contents

Description

Search in lookup datasets of each survey to find references of table_contents argument in function read_decennial, read_acs1year, and read_acs5year.

Usage

search_tablecontents(survey, years = NULL, keywords = NULL, view = TRUE)

Arguments

survey

survey type, including "dec" (or "decennial"), "acs1" or "acs5".

years

year or ending year of the survey, can be a single year such as 2010 or a vector like 2014:2016.

keywords

keyword to search in code or description, in the form like "abc def dsdfsa". Rows with all words are returned.

view

display the search result with View if TRUE

Value

A data.table

Examples

# Change view = TRUE (default) to View the returned data.
# search by what you want
aaa <- search_tablecontents("dec", 2000, "federal prison", view = FALSE)

## Not run: 
  # view all decennial census table contents
  search_tablecontents("dec")

  # view all ACS 5 year table contents
  search_tablecontents("acs5")

## End(Not run)

Search Tables

Description

Search table numbers and description.

Usage

search_tables(survey, years = NULL, keywords = NULL, view = TRUE)

Arguments

survey

survey type, including "dec" (or "decennial"), "acs1" or "acs5".

years

year or ending year of the survey, can be a single year such as 2010 or a vector like 2014:2016.

keywords

keyword to search in code or description, in the form like "abc def dsdfsa". Rows with all words are returned.

view

display the search result with View if TRUE

Value

A data.table

Examples

# Change view = TRUE (default) to View the returned data.
aaa <- search_tables("dec", 2010, "occupancy", view = FALSE)
bbb <- search_tables("acs5", 2014:2016, "detailed race", view = FALSE)

## Not run: 
  # view all tables
  search_tables("dec")
  search_tables("acs1")

## End(Not run)

Set file path to directory storing downloaded census data

Description

Set file path to directory storing downloaded census data

Usage

set_path_to_census(path)

Arguments

path

path to directory holding all downloaded census data, such as "E:/my_census_data" and "~/my_census_data/".


Vector of the abbreviations of 50 states and DC

Description

Abbrivation only

Usage

data("states_DC")

Format

A vector of 51 element


ACS 1-year table contents of all years

Description

There is slightly difference in the table contents of each year.

Usage

table_content_acs1year_all_years

Format

A data.table with 27246 rows and 7 variables

reference

reference of the table content, such as "B01001_002". The reference is used to extract data of table content.

table_content

description of columns in a table

table_name

table names

acs1_2019

restriction and availability of table content in 2019

acs1_2018

restriction and availability of table content in 2018

acs1_2017

restriction and availability of table content in 2017

acs1_2017

restriction and availability of table content in 2016

acs1_2015

restriction and availability of table content in 2015

acs1_2014

restriction and availability of table content in 2014

acs1_2013

restriction and availability of table content in 2013

acs1_2012

restriction and availability of table content in 2012

acs1_2011

restriction and availability of table content in 2011

acs1_2010

restriction and availability of table content in 2010

acs1_2009

restriction and availability of table content in 2009

acs1_2008

restriction and availability of table content in 2008

acs1_2007

restriction and availability of table content in 2007

acs1_2006

restriction and availability of table content in 2006

acs1_2005

restriction and availability of table content in 2005

uiverse

the universe of the data

Source

Check for each year of ACS 1-year and 5-year Sequence Number/Table Number Lookup File.