Open kenarab opened 4 years ago
#install.packages("devtools") #devtools::install_github("ROpenStats/COVID19analytics") library(COVID19analytics) #> Warning: replacing previous import 'ggplot2::Layout' by 'lgr::Layout' when #> loading 'COVID19analytics' #> Warning: replacing previous import 'readr::col_factor' by 'scales::col_factor' #> when loading 'COVID19analytics' #> Warning: replacing previous import 'magrittr::equals' by 'testthat::equals' when #> loading 'COVID19analytics' #> Warning: replacing previous import 'magrittr::not' by 'testthat::not' when #> loading 'COVID19analytics' #> Warning: replacing previous import 'magrittr::is_less_than' by #> 'testthat::is_less_than' when loading 'COVID19analytics' #> Warning: replacing previous import 'dplyr::matches' by 'testthat::matches' when #> loading 'COVID19analytics' #> Warning: replacing previous import 'testthat::matches' by 'tidyr::matches' when #> loading 'COVID19analytics' #> Warning: replacing previous import 'magrittr::extract' by 'tidyr::extract' when #> loading 'COVID19analytics' library(ggplot2) env.data.dir <- getEnv("data_dir") processor <- COVID19DataProcessor$new(provider.id = "JohnsHopkingsUniversity", missing.values.model.id = "imputation") dummy <- processor$setupData() #> INFO [19:21:51.967] {stage: processor-setup} #> INFO [19:21:51.999] Checking required downloaded {downloaded.max.date: 2020-06-21, daily.update.time: 21:00:00, current.datetime: 2020-06-22 1.., download.flag: FALSE} #> INFO [19:21:52.114] Checking required downloaded {downloaded.max.date: 2020-06-21, daily.update.time: 21:00:00, current.datetime: 2020-06-22 1.., download.flag: FALSE} #> INFO [19:21:52.135] Checking required downloaded {downloaded.max.date: 2020-06-21, daily.update.time: 21:00:00, current.datetime: 2020-06-22 1.., download.flag: FALSE} #> INFO [19:21:52.263] {stage: data loaded} #> INFO [19:21:52.263] {stage: data-setup} dummy <- processor$transform() #> INFO [19:21:52.266] Executing transform #> INFO [19:21:52.266] Executing consolidate #> INFO [19:21:54.135] {stage: consolidated} #> INFO [19:21:54.135] Executing standarize #> INFO [19:21:54.645] gathering DataModel #> INFO [19:21:54.646] {stage: datamodel-setup} dummy <- processor$curate() #> INFO [19:21:54.650] {stage: loading-aggregated-data-model} #> Warning in countrycode(x, origin = "country.name", destination = "continent"): Some values were not matched unambiguously: MS Zaandam #> INFO [19:21:57.103] {stage: calculating-rates} #> INFO [19:21:57.293] {stage: making-data-comparison} #> INFO [19:22:03.474] {stage: applying-missing-values-method} #> INFO [19:22:03.475] {stage: Starting first imputation} #> INFO [19:22:03.483] {stage: calculating-rates} #> INFO [19:22:03.707] {stage: making-data-comparison-2} #> INFO [19:22:09.877] {stage: calculating-top-countries} #> INFO [19:22:09.901] {stage: curated} selected.countries <- c("Argentina", "Brazil", "Peru", "Chile", "Colombia", "Cuba", "Uruguay") rg <- ReportGeneratorEnhanced$new(processor) ggplot <-rg$ggplotCountriesLines(included.countries = selected.countries, countries.text = "Selected countries", field = "rate.inc.daily", log.scale = TRUE) ggplot #> Warning: Removed 42 row(s) containing missing values (geom_path).
ggsave(file.path(env.data.dir, paste("comparison-inc.rate",".png", sep ="")), ggplot, width = 7, height = 5, dpi = 300) #> Warning: Removed 42 row(s) containing missing values (geom_path). ggplot <-rg$ggplotCountriesLines(included.countries = selected.countries, countries.text = "Selected countries", field = "confirmed.inc", log.scale = TRUE) ggplot #> Warning: Removed 42 row(s) containing missing values (geom_path).
ggsave(file.path(env.data.dir, paste("comparison-inc",".png", sep ="")), ggplot, width = 7, height = 5, dpi = 300) #> Warning: Removed 42 row(s) containing missing values (geom_path).
Created on 2020-06-22 by the reprex package (v0.3.0)
Created on 2020-06-22 by the reprex package (v0.3.0)