library(COVID19)
wb <- c("gdp" = "NY.GDP.MKTP.CD", "hosp_beds" = "SH.MED.BEDS.ZS", 
        "Over65" = "SP.POP.65UP.TO.ZS", 
        "deaths_cd" = "SH.DTH.COMM.ZS",
        "mortality" ="SP.DYN.AMRT.MA",
        "Infant_deaths"="SH.DTH.IMRT",
        "Under_5_deaths" = "SH.DTH.MORT",
        "Suicide" = "SH.STA.SUIC.P5"
        )
gmr <- "https://www.gstatic.com/covid19/mobility/Global_Mobility_Report.csv"
d  <- covid19(wb = wb)
## We have invested a lot of time and effort in creating COVID-19 Data Hub, please cite the following when using it:
## 
##   Guidotti, E., Ardia, D., (2020), "COVID-19 Data Hub", Journal of Open
##   Source Software 5(51):2376, doi: 10.21105/joss.02376.
## 
## A BibTeX entry for LaTeX users is
## 
##   @Article{,
##     title = {COVID-19 Data Hub},
##     year = {2020},
##     doi = {10.21105/joss.02376},
##     author = {Emanuele Guidotti and David Ardia},
##     journal = {Journal of Open Source Software},
##     volume = {5},
##     number = {51},
##     pages = {2376},
##   }
## 
## To retrieve citation and metadata of the data sources see ?covid19cite. To hide this message use 'verbose = FALSE'.
d %>% filter(date< Sys.Date()-7) -> d
d %>% group_by(iso_alpha_3) -> d
d %>%arrange(date) %>% mutate(New_cases = confirmed - lag(confirmed, default = first(confirmed))) -> d
d %>% mutate(New_deaths = deaths - lag(deaths, default = first(deaths))) %>% arrange(deaths) -> d
d %>% mutate(New_tests = tests - lag(tests, default = first(tests))) %>% arrange(tests) -> d
d %>% filter(administrative_area_level_1 =="United Kingdom") -> UK

aqm::dt(UK)