Perform a quick and simple financial sentiment analysis in R using the dictionary of Loughran & McDonald. It counts the number of financially positive and negative words in multiple texts at once.
> install.packages("tm")
> library(tm)
> docs <- Corpus(DirSource("foldername")) # replace foldername
Dictionaries are provided by McDonald at http://www3.nd.edu/~mcdonald/Word_Lists.html. The positive and negative word lists should be a character vector in R. For example:
> dictneg <- readLines("negative.csv")
> dictpos <- readLines("positive.csv")
See LICENSE.md for a full copy of the MIT-license.