In this post we use the basic functions of the Syuzhet package to perform sentiment analysis on the text of the State of the Union Addresses of president Barack Obama in the period 2009-2016.
Project Gutenberg makes e-texts available and through the corresponding R library we use the UTF-8 file to perform sentiment analysis on the SOTU texts. The latter are tokenized by concatenation of the lines in chunks of 10. The syuzhet package in R uses the NRC emotion lexicon and the get_nrc_sentiment function returns a data frame in which each token represents a row. The columns include eight emotions (anger, fear, anticipation, trust, surtprise, sadness, joy and disgust) as well as two sentiments (negative and positive).
Download and read the full document : syuzhet_sotu