I will be using the “brexit_polls” data set. This data set contains the poll outcomes from January to June of the 2016 EU/Brexit referendum. The question was “Should the United Kingdom remain a member of the European Union or leave the European Union”. I want to look at the months and pollsters to find any patterns.
Load the library
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.4.4 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
ggplot(brexit_polls2, aes(x = month, y = pollster, fill = samplesize)) +geom_tile() +labs(x ="Months", y ="Pollster") +ggtitle("Brexit Referendum by Months in 2016") +scale_fill_continuous(name ="Number of Voters") +scale_y_discrete(labels =c("TNS"="Transaction Network Services (TNS)", "ORB"="Opinion Research Business (ORB)", "ORB/Telegraph"="Opinion Research Business (ORB)/Telegraph", "ICM"="Institute of Commerical Management (ICM)")) +theme_classic()
Conclusion
It appears that June was the most month with the most activity and YouGov & ICM were the most active pollsters.