Ever since the City of Chicago team built the RSocrata Connector I have been dying to put together this simple tutorial for showing the ability for forecasting data in R on top of Socrata datasets. Most recently the City of Chicago updated the RSocrata connector to include write.socrata
which will have a number of interesting uses.
This example is pulling a dataset in from the City of Austin Open Data Portal containing EMS Incidents by Month and forecasting the next two years of EMS Incidents.
Three dependencies you will need are:
Step 0: getting RSocrata from GitHub
The first real step is to import the dataset as an R dataframe.
The next step is to create a time series variable based off of the response column in the dataset.
The next component is to control for seasonality that exists within the data.
Next we can forecast the dataset out a number of periods.
Let’s save these forecasted values in their own data frame
Next lets write this to Socrata
Let’s use Socrata to visualize this data as well.
RSocrata saves the Day!