Skip to content

Argentina, Chile, Brazil & more death rates

Alejandro Baranek edited this page May 24, 2020 · 1 revision
 #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 'dplyr::intersect' by 'lubridate::intersect'
#> when loading 'COVID19analytics'
#> Warning: replacing previous import 'dplyr::union' by 'lubridate::union' when
#> loading 'COVID19analytics'
#> Warning: replacing previous import 'dplyr::setdiff' by 'lubridate::setdiff' 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'
# Generate daily plots
 processor <- COVID19DataProcessor$new(provider.id = "JohnsHopkingsUniversity", missing.values.model.id = "imputation")
 dummy <- processor$setupData()
#> INFO  [13:57:25.300]  {stage: processor-setup}
#> INFO  [13:57:25.328] Checking required downloaded  {downloaded.max.date: 2020-05-23, daily.update.time: 21:00:00, current.datetime: 2020-05-24 1.., download.flag: FALSE}
#> INFO  [13:57:25.418] Checking required downloaded  {downloaded.max.date: 2020-05-23, daily.update.time: 21:00:00, current.datetime: 2020-05-24 1.., download.flag: FALSE}
#> INFO  [13:57:25.513] Checking required downloaded  {downloaded.max.date: 2020-05-23, daily.update.time: 21:00:00, current.datetime: 2020-05-24 1.., download.flag: FALSE}
#> INFO  [13:57:25.555]  {stage: data loaded}
#> INFO  [13:57:25.556]  {stage: data-setup}
 dummy <- processor$transform()
#> INFO  [13:57:25.558] Executing transform 
#> INFO  [13:57:25.559] Executing consolidate 
#> INFO  [13:57:26.761]  {stage: consolidated}
#> INFO  [13:57:26.762] Executing standarize 
#> INFO  [13:57:26.821] gathering DataModel 
#> INFO  [13:57:26.822]  {stage: datamodel-setup}
 dummy <- processor$curate()
#> INFO  [13:57:26.826]  {stage: loading-aggregated-data-model}
#> Warning in countrycode(x, origin = "country.name", destination = "continent"): Some values were not matched unambiguously: MS Zaandam
#> INFO  [13:57:28.502]  {stage: calculating-rates}
#> INFO  [13:57:28.658]  {stage: making-data-comparison}
#> INFO  [13:57:29.768]  {stage: applying-missing-values-method}
#> INFO  [13:57:29.769]  {stage: Starting first imputation}
#> INFO  [13:57:29.772]  {stage: calculating-rates}
#> INFO  [13:57:29.943]  {stage: making-data-comparison-2}
#> INFO  [13:57:30.971]  {stage: calculating-top-countries}
#> INFO  [13:57:30.986]  {stage: processed}

compared.countries <- c("Argentina", "Brazil", "Chile", "US", "Japan", "Korea, South", "Germany", "Japan", "Norway", "Sweden")
 rg <- ReportGeneratorEnhanced$new(data.processor = processor)

 ggplot <- rg$ggplotCountriesLines(included.countries = compared.countries,
                                   field.description  = "Death Rates min",
                                   field = "death.rate.min", countries.text = "Compared Countries",
                                   log.scale = TRUE)
#> Scale for 'y' is already present. Adding another scale for 'y', which will
#> replace the existing scale.
 ggplot
#> Warning: Transformation introduced infinite values in continuous y-axis

Created on 2020-05-24 by the reprex package (v0.3.0)

Clone this wiki locally