Adding incidence, mortality and lethality rates to the downloaded data
Source:R/utils.R
add_epi_rates.Rd
This function adds the incidence, mortality and lethality rates to a given data set downloaded by the covid19br::downloadCovid19() function.
Details
The function add_epi_rates() was designed to work with the original names of the variables accumDeaths, accummCases and pop available in the data set downloaded by the covid19br::downloadCovid19(). For this reason, this function must be used before any change in such variable names.
Author
Fabio N. Demarqui fndemarqui@est.ufmg.br
Examples
# \donttest{
library(covid19br)
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
brazil <- downloadCovid19(level = "brazil")
#> Downloading COVID-19 data... please, be patient!
brazil <- add_epi_rates(brazil)
glimpse(brazil)
#> Rows: 1,164
#> Columns: 12
#> $ date <date> 2023-01-01, 2023-01-02, 2023-01-03, 2023-01-04, 2023-01-…
#> $ epi_week <int> 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, …
#> $ newCases <int> 0, 31085, 28057, 32715, 27674, 26402, 11172, 1664, 21236,…
#> $ accumCases <int> 36331281, 36362366, 36390423, 36423138, 36450812, 3647721…
#> $ newDeaths <int> 0, 128, 211, 219, 158, 210, 27, 11, 100, 68, 103, 148, 78…
#> $ accumDeaths <int> 693853, 693981, 694192, 694411, 694569, 694779, 694806, 6…
#> $ newRecovered <int> 35006153, 35081933, 35147500, 35196324, 35225196, 3524775…
#> $ newFollowup <int> 631275, 586452, 548731, 532403, 531047, 534680, 519886, 4…
#> $ pop <dbl> 210147125, 210147125, 210147125, 210147125, 210147125, 21…
#> $ incidence <dbl> 17288.50, 17303.29, 17316.64, 17332.21, 17345.38, 17357.9…
#> $ lethality <dbl> 1.91, 1.91, 1.91, 1.91, 1.91, 1.90, 1.90, 1.90, 1.90, 1.9…
#> $ mortality <dbl> 330.1749, 330.2358, 330.3362, 330.4404, 330.5156, 330.615…
# }