RSocrata

A tool for downloading Socrata datasets as R data frames

Provided with a URL to a dataset resource published on a Socrata webserver, or a Socrata SoDA (Socrata Open Data Application Program Interface) web API query, or a Socrata "human-friendly" URL, returns an R data frame. Converts dates to POSIX format. Supports CSV download file formats from Socrata. Manages the throttling of data returned from Socrata. RUnit test coverage.

Usage example 1


earthquakesDataFrame <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv")
nrow(earthquakesDataFrame) # 1007 (two "pages")
class(earthquakesDataFrame$Datetime[1]) # POSIXlt

Usage example 2


earthquakesDataFrame <- read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquakes-for-2012-11-01-API-School-Demo/4334-bgaj")
nrow(earthquakesDataFrame) # 1007 (two "pages")
class(earthquakesDataFrame$Datetime[1]) # POSIXlt

Issues

Please report issues, request enhancements or fork us at the City of Chicago github.

Change log

1.1 Add check for valid Socrata resource URL. Add check for supported download file format. Add support for Socrata short dates.

1.2 Use comma-separated file format for Socrata downloads.

1.3 Added support for human-readable URL.

1.4 Add support for json file format for Socrata downloads. Switch from rjson to RJSONIO.

1.5 Switch from RJSONIO to jsonlite. More informative error messages.