library(shiny)
library(leaflet)
library(ggplot2)
library(mapview)
library(tidyr)
library(DT)
## 
## Attaching package: 'DT'
## The following objects are masked from 'package:shiny':
## 
##     dataTableOutput, renderDataTable
library(aqm)
## 
## Attaching package: 'aqm'
## The following object is masked from 'package:stats':
## 
##     dt
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(sf)
## Linking to GEOS 3.5.1, GDAL 2.1.2, PROJ 4.9.3
library(waffle)
data(ge2017)
data(ge2015)
data(constituencies)
data(party_colors)


ge2015 %>% filter(party=="UKIP") ->ukip
ukip[,c(1,6)] -> ukip
names(ukip)<-c("CODE","UKIP_2015")
data(carto)
carto_geom<-carto[,1]
constituencies_geom<-constituencies[,1]
d<- read.csv("1918-2017election_results.csv")
d$election<-as.numeric(as.character(d$election))
## Warning: NAs introduced by coercion
filter(d, election > 2009) %>% dt()
d %>% filter(election>1990) %>% group_by(country.region,election) %>% summarise(total=sum(total_votes),total_con=sum(con_votes),total_lab=sum(lab_votes), total_lib=sum(lib_votes)) %>% dt()