Text Analysis with R

We are having a little practice session. Quick notes about working through the examples in Matthew L. Jockers fine book, Text Analysis with R for Students of Literature.

Browse here:


and download the zip file that it points at here:


Save that zip file INSIDE a project folder. My folder is called R-text.

Unzip that package! (Don't just let the file manager peer inside it. You need to extract it.) It creates a directory called:


Inside there, there is a directory structure, including text files and R code. Use the file manager to change into the directory "start.up.code" and then a chapter, such as "chapter.3".

If you open the R file in an R-aware editor (eg Rstudio), the code won't run as it is. But is easy to fix. Change the name of the data file by inserting "../../" at the beginning. Like so

text.v <- scan("../../data/plainText/melville.txt", what="character", sep="\n")

After doing that, you can step through the example code line by line.

It appears to me the starter code has all of the basic data manipulation work. It does not include the code to manufacture graphs.

We can explore that when we meet together...

About Paul Johnson

CRMDA Director, professor of political science. Interests include Linux system administration, statistical analysis, programming, and the Denver Broncos.
This entry was posted in Data Analysis, R. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *