Skip to content

ICS02: 8. Introduction to R

Christopher Ohge edited this page Feb 28, 2019 · 30 revisions

Sunoikisis Digital Classics, Spring 2019

Session 8. Introduction to programming through R

Thursday Feb 28, 16:00 UK = 18:00 EET

Convenors: Christopher Ohge & Gabriel Bodard (University of London)

YouTube link: https://youtu.be/X8iCDZVgWSA

Download R Notebook

Access the HTML version of the notebook, with the visualisations

Session outline

This session will introduce will introduce basic programming concepts with the R language. After an introductory lesson on regular expressions, R syntax, and basic R functions, we will use the tidy text library package to perform text analysis tasks.

Plan

  1. Christopher [CO] reads outline

  2. Preliminary remarks (5 min), Gabby [GB] and CO:

  • Most common programming languages in DH

  • Why R & why is it important?

  1. Regular expressions (15 min), GB:
  • Exercises on gutenberg texts
  1. Intro to R and tidytext (40 min), CO

Installing R and RStudio

Before the session, make sure to download the R software package from http://www.r-project.org/.

  • Click on "download R."

  • Choose the appropriate CRAN mirror in your area for downloading (for me it's the UK > Imperial College London link).

  • Download and install the appropriate R 3.5.2 binary for your operating system.

Then download the latest version of RStudio at https://www.rstudio.com.

  • Click on "Download RStudio."

  • Download the RStudio Desktop (free) version.

  • Chose the appropriate installer: Most of you will use either RStudio 1.1.463 - Windows Vista/7/8/10 or Mac OS X 10.6+.

Seminar readings

Further reading

Other resources

Essay title

  • tba

Exercise

  1. Download a txt file from Project Gutenberg or the Perseus Project. Load the text file into RStudio and use a regular expression(s) to limit your results.

  2. Using the gutenbergr package, load some new text files (more than one, please) that interest you. Create a tidy tibble of the textual data and chose a visualisation method for displaying your results.

  3. Based on your results, posit a new question--or questions--about what you would like to investigate further. Modify a code block(s) from Part I of the R Notebook to answer your question.

Clone this wiki locally