Human faces provide various information about emotions. Microsoft launched a free service in December 2015 to analyze human faces detecting their emotions. The emotions detected are anger, contempt, disgust, fear, happiness, neutral, sadness, and surprise. These emotions are understood to be cross-culturally and universally communicated with particular facial expressions.

The Emotion API takes an facial expression in an image as an input, and returns the confidence across a set of emotions for each face in the image, as well as bounding box for the face, using the Face API.

The implementation in R allows to analyze human faces in a structured way. Note, that one have to create an account to use the Face API.

The example is referred to a simple example:

You need four R packages: httr, XML, stringr, ggplot2.

Analyze Face Emotions with R: