Package censusapi. August 19, 2018

Similar documents
Package censusr. R topics documented: June 14, Type Package Title Collect Data from the Census API Version 0.0.

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package fitbitscraper

Package fastdummies. January 8, 2018

Package ECctmc. May 1, 2018

Package qualmap. R topics documented: September 12, Type Package

Package calpassapi. August 25, 2018

Package SEMrushR. November 3, 2018

Package repec. August 31, 2018

Package facerec. May 14, 2018

Package shinyfeedback

Package datasets.load

Package cancensus. February 4, 2018

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package internetarchive

Package fingertipsr. May 25, Type Package Version Title Fingertips Data for Public Health

Package virustotal. May 1, 2017

Package dkanr. July 12, 2018

Package rgho. R topics documented: January 18, 2017

Package validara. October 19, 2017

Package robotstxt. November 12, 2017

Package goodpractice

Package barcoder. October 26, 2018

Package gtrendsr. October 19, 2017

Package postgistools

Package statsdk. September 30, 2017

Package bisect. April 16, 2018

Package opencage. January 16, 2018

Package areal. December 31, 2018

Package gtrendsr. August 4, 2018

Package oec. R topics documented: May 11, Type Package

Package strat. November 23, 2016

Package editdata. October 7, 2017

Package httpcache. October 17, 2017

Package nlgeocoder. October 8, 2018

Package condusco. November 8, 2017

Package vinereg. August 10, 2018

Package smapr. October 20, 2017

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package canvasxpress

Package data.world. April 5, 2018

Package omu. August 2, 2018

Package GetITRData. October 22, 2017

Package rzeit2. January 7, 2019

Package modmarg. R topics documented:

Package tidytransit. March 4, 2019

Package githubinstall

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package samplesizecmh

Package lumberjack. R topics documented: July 20, 2018

Package deductive. June 2, 2017

Package aws.transcribe

Package rprojroot. January 3, Title Finding Files in Project Subdirectories Version 1.3-2

Package WordR. September 7, 2017

Package labelvector. July 28, 2018

Package rwars. January 14, 2017

Package reval. May 26, 2015

Package raker. October 10, 2017

Package patentsview. July 12, 2017

Package ecoseries. R topics documented: September 27, 2017

Package elasticsearchr

Package pdfsearch. July 10, 2018

Package triebeard. August 29, 2016

Package preprosim. July 26, 2016

Package liftr. R topics documented: May 14, Type Package

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package nngeo. September 29, 2018

Package rnrfa. April 13, 2018

Package AutoDeskR. July 10, 2017

Package rsppfp. November 20, 2018

Package genesysr. June 14, 2018

Package wikitaxa. December 21, 2017

Package TrafficBDE. March 1, 2018

Package sfdct. August 29, 2017

Package embed. November 19, 2018

Package loggit. April 9, 2018

Package geniusr. December 6, 2017

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package jdx. R topics documented: January 9, Type Package Title 'Java' Data Exchange for 'R' and 'rjava'

Package knitrprogressbar

Package promote. November 15, 2017

Package pwrab. R topics documented: June 6, Type Package Title Power Analysis for AB Testing Version 0.1.0

Package jstree. October 24, 2017

Package jpmesh. December 4, 2017

Package MatchIt. April 18, 2017

Package kdtools. April 26, 2018

Package spelling. December 18, 2017

Package splithalf. March 17, 2018

Package pdfetch. October 15, 2017

Package essurvey. August 23, 2018

Package bigqueryr. October 23, 2017

Package wrswor. R topics documented: February 2, Type Package

Package ClustGeo. R topics documented: July 14, Type Package

Package readxl. April 18, 2017

Package sfc. August 29, 2016

Package eply. April 6, 2018

Package edfreader. R topics documented: May 21, 2017

Package svalues. July 15, 2018

Package GFD. January 4, 2018

Package kirby21.base

Transcription:

Version 0.4.1 Title Retrieve Data from the Census APIs Package censusapi August 19, 2018 A wrapper for the U.S. Census Bureau APIs that returns data frames of Census data and metadata. Available datasets include the Decennial Census, American Community Survey, Small Area Health Insurance Estimates, Small Area Income and Poverty Estimates, and Population Estimates and Projections. See <https://www.census.gov/data/developers/data-sets.html> for more information. URL https://github.com/hrecht/censusapi BugReports https://github.com/hrecht/censusapi/issues Depends R (>= 3.0.0) License GPL-3 LazyData true RoxygenNote 6.0.1 Imports httr, jsonlite Suggests knitr, rmarkdown VignetteBuilder knitr NeedsCompilation no Author Hannah Recht [aut, cre] Maintainer Hannah Recht <hrecht2@gmail.com> Repository CRAN Date/Publication 2018-08-19 21:00:03 UTC R topics documented: fips.............................................. 2 getcensus.......................................... 2 listcensusapis....................................... 4 listcensusmetadata..................................... 4 makevarlist......................................... 5 Index 6 1

2 getcensus fips List of state fips codes - 50 states plus DC Some small geographies in some Census APIs can only be used under a state hierarchy. This is a list of fips codes that may be looped over to retrieve data for all states. fips Format A list of state fips codes Source https://www.census.gov/geo/reference/ansi_statetables.html fips getcensus Retrieve Census data from a given API Retrieve Census data from a given API getcensus(name, vintage = NULL, key = Sys.getenv("CENSUS_KEY"), vars, region, regionin = NULL, time = NULL, date = NULL, period = NULL, monthly = NULL, category_code = NULL, data_type_code = NULL, naics = NULL, pscode = NULL, naics2012 = NULL, naics2007 = NULL, naics2002 = NULL, naics1997 = NULL, sic = NULL)

getcensus 3 Arguments name vintage key vars region API name - e.g. acs5. See list at https://api.census.gov/data.html Year of dataset, e.g. 2014 - not required for timeseries APIs Your Census API key, gotten from https://api.census.gov/data/key_signup.html List of variables to get Geography to get regionin Optional hierarchical geography to limit region time, date, period, monthly Optional arguments used for some time series APIs category_code, data_type_code Arguments used in Economic Indicators Time Series API naics, pscode Arguments used in Annual Survey of Manufactures API naics2012, naics2007, naics2002, naics1997, sic Arguments used in Economy Wide Key Statistics APIs and Business Patterns APIs df <- getcensus(name = "acs/acs5", vintage = 2016, vars = c("b01001_001e", "NAME", "B01002_001E", "B19013_001E"), region = "tract:*", regionin = "state:06") head(df) # Use American Community Survey variable groups to get all data from a given table. # This returns estimates as well as margins of error and annotation flags. acs_group <- getcensus(name = "acs/acs5", vintage = 2016, vars = c("name", "group(b19013)"), region = "county:*") head(acs_group) # Retreive block-level data within a specific state and county using a nested regionin argument data2010 <- getcensus(name = "dec/sf1", vintage = 2010, vars = c("p001001", "H010001"), region = "block:*", regionin = "state:36+county:027") head(data2010) # Retreive block-level data for Decennial Census sf1, 2000 # Note, for this dataset a tract needs to be specified to retrieve blocks data2000 <- getcensus(name = "sf1", vintage = 2000, vars = c("p001001", "P003001"), region = "block:*", regionin = "state:36+county:27+tract:010000") head(data2000) # Get time series data saipe <- getcensus(name = "timeseries/poverty/saipe", vars = c("name", "SAEPOVRT0_17_PT", "SAEPOVRTALL_PT"), region = "state:*", time = 2011) head(saipe)

4 listcensusmetadata # Get county business patterns data for a specific NAICS sector cbp_2016 <- getcensus(name = "cbp", vintage = "2016", vars = c("emp", "ESTAB", "NAICS2012_TTL", "GEO_TTL"), region = "state:*", naics2012 = "23") head(cbp_2016) listcensusapis Get dataset metadata on all available APIs as a data frame Scrapes https://api.census.gov/data.json and returns a dataframe that includes: title, name, vintage (where applicable), url, istimeseries (binary), temporal (helpful for some time series), description, modified date listcensusapis() apis <- listcensusapis() head(apis) listcensusmetadata Get variable or geography metadata for a given API as a data frame Get variable or geography metadata for a given API as a data frame listcensusmetadata(name, vintage = NULL, type = "variables") Arguments name vintage type API name - e.g. acs5. See list at https://api.census.gov/data.html Vintage of dataset, e.g. 2014 - not required for timeseries APIs Type of metadata to return, either "variables", "geographies" or "geography", or "groups". Default is variables.

makevarlist 5 bds_vars <- listcensusmetadata(name = "timeseries/bds/firms", type = "variables") head(bds_vars) bds_geos <- listcensusmetadata(name = "timeseries/bds/firms", type = "geography") head(bds_geos) acs_geos <- listcensusmetadata(name = "acs/acs5", vintage = 2016, type = "geography") head(acs_geos) acs_groups <- listcensusmetadata(name = "acs/acs5", vintage = 2016, type = "groups") head(acs_groups) makevarlist Use variable metadata to find variables containing a given string. Return a list of variable names or data frame of variable metadata containing a given string. This can be used create a list of variables to later pass to getcensus, or a data frame documenting variables used in a given project. makevarlist(name, vintage = NULL, find, varsearch = "all", output = "list") Arguments name vintage find varsearch output API name - e.g. acs5. See list at https://api.census.gov/data.html Year of dataset, e.g. 2014 - not required for timeseries APIs A string to find in the variable metadata Optional argument specifying which fields to search. Default is "all". Options are "all", "name", "label", or "concept". Optional argument, specifying output to "list" or "dataframe". Default is "list". # Return a list, and then use getcensus function to retrieve those variables myvars <- makevarlist(name = "timeseries/poverty/saipe", find = "Ages 0-4", varsearch = "label") myvars saipe_dt <- getcensus(name = "timeseries/poverty/saipe", time = 2016, vars = myvars, region = "state:*") head(saipe_dt)

Index Topic api getcensus, 2 Topic datasets fips, 2 Topic metadata listcensusapis, 4 listcensusmetadata, 4 fips, 2 getcensus, 2 listcensusapis, 4 listcensusmetadata, 4 makevarlist, 5 6