Skip to content

R package for calling the U.S. Census Bureau's Geocoder API

License

Notifications You must be signed in to change notification settings

tonydurst/censusxy

 
 

Repository files navigation

censusxy

lifecycle Travis-CI Build Status AppVeyor Build Status Coverage status DOI CRAN_status_badge

The censusxy package is designed to provide easy and efficient access to the U.S. Census Bureau Batch Geocoder in R. The package offers a batch solution for address geocoding (as opposed to packages like censusr, which provide functionality for a single address at a time). censusxy has also been developed specifically with large data sets in mind - only unique addresses are passed to the API for geocoding. If a data set exceeds 1,000 unique addresses, it will be automatically subset into appropriately sized API calls, geocoded, and then put back together so that a single object is returned.

Installation

Installing Dependencies

You should check the sf package website and the censusxy package website for the latest details on installing dependencies for that package. Instructions vary significantly by operating system. For best results, have sf installed before you install censusxy. Other dependencies, like dplyr, will be installed automatically with censusxy if they are not already present.

Installing censusxy

Once sf is installed, the easiest way to get censusxy is to install it from CRAN:

install.packages("censusxy")

Alternatively, the development version of censusxy can be accessed from GitHub with remotes:

# install.packages("remotes")
remotes::install_github("slu-openGIS/censusxy")

Usage

The censusxy package contains two data sets, stl_homicides (n = 1,812) and stl_homicides_small (n = 24), that can be used to demonstrate the functionality of the package. The stl_homicides_small data is included specifically for quick experimentation, as its small sample size ensures an expedient response from the API.

To test censusxy’s functionality, load the package and either of the sample data sets:

library(censusxy)

data <- stl_homicides

There are two possible variable configurations (minimal and full, specified using the style argument), and two possible output types (tibble and sf, specified using the output argument):

homicide_sf <- cxy_geocode(data, address = street_address, city = city, state = state, 
    style = "minimal", output = "sf")

If you request an sf object, you easily preview the results with the mapview package:

> mapview::mapview(homicide_sf)

Contributor Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

About

R package for calling the U.S. Census Bureau's Geocoder API

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • R 90.7%
  • Shell 9.3%