Skip to content

ICS02: 8. Introduction to R

Christopher Ohge edited this page Mar 4, 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

Access the R notebook

Access the HTML version of the R 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

Exercises

  1. Create a regular expression to remove those non-words in dickens.words.v.

  2. Create a regular expression for only dialogue words in dickens.words.v. Modify the Jockers for loop by confining your word frequency results to only dialogue.

  3. 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.

  4. 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