French Presidential Election Data Project

Posted: May 09, 2017

Now that the debating, tweeting, and voting is over in France, it's time to start analyzing the data!

The French government does a very good job of making election results available online...and of course, in France, it's all a centralized operation, rather than 50+ separate election authorities, each with its own set of procedures, publication formats, etc. Thus there is one place to go for the data, and its standardized across the 36,000+ communes nationwide.

Over the past couple of evenings, I pulled together a simple R package that scrapes the results, then joins Departement and Region identifiers to enable rollups at higher levels of aggregation than the commune. Check out the package details on the D4D election-transparency project github site for the picky details. Or, install the package directly from github and access the data that way:


# install.packages("devtools")
devtools::install_github("Data4Democracy/election-transparency/r-packages/frelections")

frelections::Results2017 %>% filter(Round=='2') %>% group_by(Candidate) %>%
	summarize(Votes=sum(Votes)) %>% mutate(Percent=Votes/sum(Votes))
# A tibble: 2 × 3
           Candidate    Votes  Percent
                       
1 M. Emmanuel MACRON 19403484 0.649181
2  Mme Marine LE PEN 10485690 0.350819
There are two data frames included in the package, Turnout2017 with turnout counts, and Results2017 with results counts. There are data from both rounds.

If R is not your thing, I have also uploaded them to data.world, from which you can consume them as .csv files.

Enjoy!