library(tidyverse)
## ── Attaching packages ────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.1.0 ✔ purrr 0.3.2
## ✔ tibble 3.0.3 ✔ dplyr 1.0.2
## ✔ tidyr 1.1.2 ✔ stringr 1.4.0
## ✔ readr 1.3.1 ✔ forcats 0.3.0
## ── Conflicts ───────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(lubridate)
##
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
##
## date
library(COVID19)
library(sf)
## Linking to GEOS 3.5.1, GDAL 2.1.2, PROJ 4.9.3
library(mapview)
#gmr <- "https://www.gstatic.com/covid19/mobility/Global_Mobility_Report.csv"
#d <- covid19(country="GBR",gmr = gmr, level=3)
#save(d,file=sprintf("UK_data%s_l3.rda",Sys.Date()))
load(sprintf("UK_data%s_l3.rda",Sys.Date()))
shp<-st_read("england_ct_2011.shp")
## Reading layer `england_ct_2011' from data source `/home/rstudio/webpages/epidemiology/UK_mobility/england_ct_2011.shp' using driver `ESRI Shapefile'
## Simple feature collection with 152 features and 3 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: 82643.6 ymin: 5333.602 xmax: 655989 ymax: 657599.5
## epsg (SRID): NA
## proj4string: +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +datum=OSGB36 +units=m +no_defs
shp$code<-aqm::clean(shp$code)
dd<-(data.frame(name=d$administrative_area_level_3,date=d$date,code=as.character(d$key),work=d$workplaces_percent_change_from_baseline))
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
ggplot(dd,aes(x=date,y=work,group=name)) +geom_point() ->g1
# dd %>% filter(date==(max(date)-14)) ->dd
# dim(dd)
# dd<-merge(shp,dd)
# dim(dd)
# mapview(dd)
aqm::dt(dd)
## Warning in instance$preRenderHook(instance): It seems your data is too
## big for client-side DataTables. You may consider server-side processing:
## https://rstudio.github.io/DT/server.html