Are you happy or sad?

January 10, 2016

(This article was first published on Renglish – 56north | Skræddersyet dataanalyse, and kindly contributed to R-bloggers)

Well, if you wrote about it we might be able to figure it out with my new package: happyorsad

Happyorsad is a sentiment scorer. It uses the approach of Finn Årup Nielsen from Informatics and Mathematical Modelling at the Technical University of Denmark and this AFINN lists hosted in his Github repo.

Finn Årup Nielsen has constructed three lists that makes it possible to sentiment score in english, danish and using emoticons. There are already a few sentiment packages for english, but this is the first one for danish and as far as I now also the first one to sentiment score emoticons.

A big shout out to Finn for the lists.

If you want to try it out then just run the code below. Looking forward to your feedback!

if(!require("devtools")) install.packages("devtools")

# Examples of sentiment scoring


# Score danish words
string_da <- 'Hvis ikke det er det mest afskyelige elendige flueknepperi...'
happyorsad(string_da, "da")

# Score english words
string_en <- 'This is utterly excellent!'
happyorsad(string_en, "en")

# Score emoticons
string_emoticon <- 'I saw that yesterday :)'
happyorsad(string_emoticon, "emoticon")

To leave a comment for the author, please follow the link and comment on their blog: Renglish – 56north | Skræddersyet dataanalyse. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Mango solutions

plotly webpage

dominolab webpage

Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training




CRC R books series

Six Sigma Online Training

Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)