| Type: | Package | 
| Title: | Collect Data from the Census API | 
| Version: | 0.0.4 | 
| Date: | 2018-01-23 | 
| Description: | Use the US Census API to collect summary data tables for SF1 and ACS datasets at arbitrary geographies. | 
| URL: | https://github.com/transportfoundry/censusr | 
| BugReports: | https://github.com/transportfoundry/censusr/issues | 
| License: | MIT + file LICENSE | 
| LazyData: | TRUE | 
| Depends: | dplyr (≥ 0.4.3), httr (≥ 1.0.0) | 
| Suggests: | knitr, rmarkdown, xml2 | 
| VignetteBuilder: | knitr | 
| RoxygenNote: | 6.0.1 | 
| Imports: | stringr | 
| NeedsCompilation: | no | 
| Packaged: | 2018-01-25 16:25:05 UTC; gregmacfarlane | 
| Author: | Greg Macfarlane [cre, aut], Josie Kressner [aut] | 
| Maintainer: | Greg Macfarlane <greg@transportfoundry.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2018-01-25 16:40:14 UTC | 
censusr: A package to download Census API data
Description
The censusr package provides principally one main function: call_census_api allows users to pass a list of variables and a list of geographies, and returns a data_frame with the requested data.
Aggregated margin of error across multiple geographies
Description
Aggregated margin of error across multiple geographies
Usage
aggregate_moe(x)
Arguments
| x | A numeric vector containing margins of error for estimates in multiple geographies. | 
Details
Applies a root sum of squared errors. See page A-14 of this guide: https://www.census.gov/library/publications/2009/acs/researchers.html
Value
The aggregated margin of error for the geographies.
Author(s)
Josie Kressner
Examples
x <- c(3, 5, 12, 4)
aggregate_moe(x)
data_frame(x = x, group = c(1, 1, 2, 2)) %>%
  group_by(group) %>%
  summarise(moe = aggregate_moe(x))
Retrieve GEOID from the Census Geocoder by address
Description
Returns GEOID for 2010 geographies.
Usage
append_geoid(address, geoid_type = "bl")
Arguments
| address | A tibble/data frame with (at a minimum, others can be present) either character columns street, city, and state OR numeric columns lat and lon. Lat/lon columns take priority. | 
| geoid_type | GEOID level to return,  | 
Details
It is possible in some situations for the geolocator API to return a 500 error. Repeating the call should avoid this.
Value
the original tibble with GEOIDs appended as a new column called
geoid.
Examples
## Not run: 
airports <- dplyr::data_frame(
  street = "700 Catalina Dr", city = "Daytona Beach", state = "FL"
)
append_geoid(airports, 'tr')
## End(Not run)
Call Census API for a set of variables
Description
This is an internal function and is not intended for users. See instead call_census_api.
Usage
call_api_once(variables_to_get, geoid, allgeos, data_source, year, period,
  api_key)
Arguments
| variables_to_get | A character vector of the desired variable names for the Census API call, defined at https://www.census.gov/data/developers/data-sets.html | 
| geoid | A character string with a FIPS code, between 2 and 15 digits long. | 
| allgeos | (optional) A string identifying the type of geography for
which to collect data within the the requested  | 
| data_source | A string identifying whether the SF1 (decennial census) or ACS data is desired. | 
| year | If  | 
| period | If  | 
| api_key | The user's Census API key (as a character string). You can get
a free key from [Census](http://api.census.gov/data/key_signup.html). See
 | 
Value
A codedata.frame with the requested variables at the requested geography.
Retrieve data from the Census API
Description
Returns Census data for the 2010 SF1 or ACS 2013-2015 1-, 3-, and 5-Yr aggregations for requested variables and geographies.
Usage
call_census_api(variables_to_get, names = NULL, geoids, allgeos = NULL,
  data_source = c("sf1", "acs"), year = 2013, period = 5,
  api_key = NULL)
Arguments
| variables_to_get | A character vector of the desired variable names for the Census API call, defined at https://www.census.gov/data/developers/data-sets.html | 
| names | A character vector of the same length as  | 
| geoids | A character vector of FIPS codes; must be at least to the county (5-digit) level, and can accept down to blocks (15-digit). | 
| allgeos | (optional) A string identifying the type of geography for
which to collect data within the the requested  | 
| data_source | A string identifying whether the SF1 (decennial census) or ACS data is desired. | 
| year | If  | 
| period | If  | 
| api_key | The user's Census API key (as a character string). You can get
a free key from [Census](http://api.census.gov/data/key_signup.html). See
 | 
Details
See vignette('censusr', package = 'censusr') for examples.
Value
a data_frame with each requested variable at each requested geography.
Call gelocator for one address
Description
Call gelocator for one address
Usage
call_geolocator(street, city, state)
Arguments
| street | A character string indicating a street name and number | 
| city | A character string indicating a city | 
| state | A two-digit character string with a state postal code | 
Value
A character string representing the Census block of the supplied address.
importFrom utils URLencode importFrom httr GET stop_for_status
Call gelocator for one address with lat/lon
Description
Call gelocator for one address with lat/lon
Usage
call_geolocator_latlon(lat, lon)
Arguments
| lat | A numeric value | 
| lon | A numeric value | 
Value
A character string representing the Census block of the supplied lat/lon.
importFrom utils URLencode importFrom httr GET stop_for_status
Construct a geography request string from a FIPS Code
Description
Construct a geography request string from a FIPS Code
Usage
get_geo_url(geoid, allgeos)
Arguments
| geoid | A character string with a FIPS code, between 2 and 15 digits long. | 
| allgeos | (optional) A string identifying the type of geography for
which to collect data within the the requested  | 
Value
A string with the FIPS formatted for an API request.