nd sentiment analysis of
In light of the first round of the presidential elections in France (23 april 2017), we analyzed the correspondence between the quality of life characterisation of French departments and the elections results. The relationship between quality of life and voting behaviour (votes for Macron, resp. votes for Le Pen) is most pronounced in the top 10 ranked departments and the 10 departments with the lowest ranking on the quality of life index.
Dowload and read the full document : quality_of_life_and_voting_behaviour
In this post we document the workflow (using R) to produce a choropleth map and an isarithmic map representing the results of the presidential election in France (2nd round, 7 may 2017).
- Choropleth map of the results of the presidential election
First, we download a shapefile of the municipalities in France (data source : https://www.data.gouv.fr/fr/datasets/decoupage-administratif-communal-francais-issu-d-openstreetmap (january 2017). We use this shapefile to map the results of the second round of the presidential election (data source : https://public.opendatasoft.com/explore/dataset/election-presidentielle-2017-tour-2).
communes <- readOGR(“.”,”communes-20170112″)
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