Digital Humanities Lab

Office Hours Workshop on R

May 24, 2016

Coffee and Code Workshop: R

Part 1: Tuesday, May 24 at 2:00pm in Sterling Memorial Library, 315

Part 2: Tuesday, May 31 at 2:00pm in the Digital Humanities Lab (Sterling Memorial Library, 316)

DH Developer Douglas Duhaime will lead an informal, two-part workshop on creating distribution plots in R to visualize word frequencies. In Part 1, participants will learn how to create a plot based on a single text file. In Part 2, participants will incorporate facet wrapping into the code produced during Part 1 in order to plot "small multiples" (this is what you would do if you had more than one text file you were working with). To structure the workshop, we will be referring to Chapter 4 of Matthew Jockers's Text Analysis with R for Students of Literature. For Yale affiliates, the book is available electronically via Springer Link. A print copy is also available for reading in the DHLab.

All are welcome; no programming experience is required! Participants should bring a laptop with them to the workshop.

Prior to the workshops, participants should download R and RStudio. Please also install the package "ggplot2" in RStudio. Sample text files will be provided, but participants are encouraged to work with their own data during the week between the two workshops.

To install the ggplot2 package:

  • Open RStudio
  • Click "File" in the top header and select "New File -> R Script"
  • In the new file that opens (this will likely appear above the "Console window" on your screen), type on line 1: install.packages("ggplot2")
  • At the end of line 1, hold the "Control" key and click "Enter/Return" to execute the code

Email with any questions.

Materials from workshops

Barnabae Epistula, sample text file from Workshop Part 1

Link to the GitHub page with code from both workshops

External link: