This post started as an exploration of different types of sentiment analysis. However, I ran into some issues using quanteda. Because of these issues, it occurred to me that I should probably do a post on Quanteda. Therefore, this is now a post using quanteda for text analysis, including sentiment analysis. It should be stated here, that I am largely following the tutorial at quanteda’s home page. Please go there to follow the tutorial because it is possible for some functions to change. This page is largely to remind myself of what packages I’ve used.

First, we are going to install the quanteda package.

install.packages("quanteda")

We will also need to load the following functions separately: install.packages("quanteda.textmodels") install.packages("quanteda.textstats") install.packages("quanteda.textplots")

install.packages("quanteda.textmodels")
install.packages("quanteda.textstats")
install.packages("quanteda.textplots")

We also use the readtext package to read in txt files.

install.packages("readtext")

Some of the tutorials we will look at are in the quanteda.corpora package.