Analyzing emotions in video with R

January 6, 2017

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

In the run-up to the election last year, Ben Heubl from The Economist used the Emotion API to chart the emotions portrayed by the candidates during the debates (note: auto-play video in that link). In his walkthrough of the implementation, Ben used Python to process the video files, and R to create the charts from the sentiment scores generated by the API.

Now, the learn dplyr blog has recreated the analysis using R. A detailed walkthrough steps through the process of creating a free Emotion API key, submitting a video to the API using the httr package, and retrieving the emotion scores as an R data frame. 

With the emotion scores in hand, the blog visualizes the data using, a web-based data exploration GUI based on R. With a few points and clicks (plus a little R code to wrangle the data), Exploratory produced this chart of the emotions expressed by the two candidates over time. (Click for an interactive version.) 


For the complete details, including the R code used to interface with the Emotion API, follow the link below.

Learn dplyr: Analyzing Emotions using Facial Expressions in Video with Microsoft AI and R

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. 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.


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)