1 of 43

An Introduction to R for Digital Historians

DHSS, 20 June 2017

Yannick Rochat

Junior Lecturer, UNIL

2 of 43

Some of my R projects…

3 of 43

4 of 43

5 of 43

6 of 43

7 of 43

8 of 43

What is R?

9 of 43

Who created it?

10 of 43

Who is using it?

11 of 43

What about R and History?

12 of 43

The Programming Historian

Afanador-Llach et al. (eds.) (2017)

http://programminghistorian.org/

13 of 43

14 of 43

15 of 43

Humanities Data in R

Exploring Networks, Geospatial Data, Images, and Text

Arnold & Tilton (2015) http://humanitiesdata.org/

(You can find it on libgen btw.)

16 of 43

17 of 43

18 of 43

Computational Historical Thinking

Lincoln Mullen

http://dh-r.lincolnmullen.com/

(in progress)

19 of 43

20 of 43

Why computational history?

  • Scale
  • Frame questions differently
  • Make sources legible
  • Interactivity

21 of 43

Lincoln Mullen’s datasets for historians

https://github.com/ropensci/historydata

22 of 43

Is R the only option?

23 of 43

Of course not…

24 of 43

… but the community is lively, ever growing, and super nice…

25 of 43

https://hackernoon.com/which-programming-languages-have-the-happiest-and-angriest-commenters-ebe91b3852ed

26 of 43

General Introduction

27 of 43

It’s an interpreted language

… meaning you can read it.

28 of 43

And with the pipes…

… you can even read it from left to right. (Might not seem cool but really, it is.)

http://r4ds.had.co.nz/pipes.html

29 of 43

«How I learnt to code in one year»

30 of 43

Where/How do I use R?

31 of 43

Console (meh…)

32 of 43

R GUI (better)

33 of 43

… or RStudio (great for beginners)

34 of 43

35 of 43

In particular, RStudio provides notebooks.

36 of 43

37 of 43

You can make computation inside of the script…

38 of 43

… export a webpage…

39 of 43

… or even export slides.

40 of 43

RStudio cheat sheets

41 of 43

42 of 43

43 of 43

Now, let’s move to the notebook

of this course and practice.