Visualizing History in Rio de Janeiro

Screenshot of Claudia's Data Visualization

The 2016 Summer Olympics are drawing lots of attention to Rio de Janeiro. But while most people are focused on the current games -- as well as current events, politics, and health issues that might impact the games -- others have been spending their time delving into the history of this more than 450 year-old city. And Stanford Libraries' own Claudia Engel couldn't resist dipping her hand in either.

You've heard here on our blog before about a data set on the slave trade in Rio that is preserved in the Stanford Digital Repository. These data from Zephyr Frank's group were used to create a fascinating visualization of how these markets worked.

And just recently Jack Reed, one of our other Stanford Libraries staff members, decided he wanted to show how easy it would be to create a histogram by pulling these very same data directly into R from the Stanford Digital Repository files.

Claudia Engel, Academic Technology Specialist for Anthropology, said that when she saw Jack's visualization she "got carried away." Claudia works a lot with R. She also has a keen interest in data visualizations and in making it easier for people to use the Libraries' collections of data. 

Claudia combined these interests and a few tools -- a .csv file held in the Stanford Digital Repository, R, plotly, leaflet, and shiny -- to put together an interactive and attractive web visualization in "an afternoon or two."

Screenshot of Full Visualization

"The advantage of using data from the SDR for this, is that the csv file will be there forever, so the link will never be obsolete. The R code will be obsolete sooner," says Claudia. It also makes it easier to share the code, because anyone can run the code and generate the same visualization without needing to have the data file on their local machine. "Sharing the data in a csv format makes it accessible; the SDR PURL makes it persistent."

The web-based visualization packages that Claudia used -- plotly, leaflet, and shiny -- mean that you never have to touch javascript to create this kind of end product. With R and these packages, it's possible to create a sophisticated web site without writing lots of lines of code. Claudia has shared her code at GitHub, so you can see exactly how she did it!

If you'd like to read more about the history of Rio de Janeiro, check out Zephyr Frank's new book, "Reading Rio de Janeiro, Literature and Society in the Nineteenth Century."