Using R with the Stanford Digital Repository
In honor of the useR! 2016 Conference taking place this week, we wanted to outline ways researchers can use the Stanford Digital Repository to power their R visualizations.
The Stanford Digital Repository allow Stanford researchers and affiliates to deposit research data for preservation, access, and discovery. Data deposited in the repository is citable and from which the original content can be downloaded. The data is then made available through open web standard services for consumption. For example, images in the repository are delivered by a IIIF-compatible service, geospatial data are served out as Web Mapping Services (WMS) and Web Feature Services (WFS), and generic files are all served through HTTP.
R users can take advantage of these web services and the data being served out.
For example, the Spatial History Project at Stanford has a really interesting visualization about the slave market in 19th century Rio de Janerio. The project also submitted their data to SDR which provides a PURL, located at https://purl.stanford.edu/wt635jq5834.
The data is made available through HTTP from a performant cached location. This allows R users to use the RCurl package to directly access the data and start creating visualizations. Here is an example in four lines of R that recreates a histogram used in the original visualization.
This is one example using the HTTP web services provided by SDR. For large datasets there is also the ability to stream to help with performance. For geospatial datasets residing in SDR you could also use the rwfs package to create other types of visualizations using the WFS services.