Type: | Package |
Title: | Brazilian COVID-19 Pandemic Data |
Version: | 1.0.0 |
Description: | Set of functions to import COVID-19 pandemic data into R. The Brazilian COVID-19 data, obtained from the official Brazilian repository at https://covid.saude.gov.br/, is available at the country, region, state, and city levels. The package also downloads world-level COVID-19 data from Johns Hopkins University's repository. COVID-19 data is available from the start of follow-up until to May 5, 2023, when the World Health Organization (WHO) declared an end to the Public Health Emergency of International Concern (PHEIC) for COVID-19. |
URL: | https://fndemarqui.github.io/covid19br/ |
BugReports: | https://github.com/fndemarqui/covid19br/issues |
Encoding: | UTF-8 |
License: | MIT + file LICENSE |
Depends: | R (≥ 3.5.0) |
Imports: | data.table, dplyr, httr2, rlang, sf, tibble, tidyr |
Suggests: | ggrepel, kableExtra, knitr, leaflet, pracma, plotly, rmarkdown, testthat, tidyverse |
LazyData: | true |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-08-18 22:01:30 UTC; fndemarqui |
Author: | Fabio Demarqui [aut, cre, cph], Cristiano Santos [aut], Matheus Costa [ctb] |
Maintainer: | Fabio Demarqui <fndemarqui@est.ufmg.br> |
Repository: | CRAN |
Date/Publication: | 2025-08-18 23:50:45 UTC |
Brazilian COVID-19 Pandemic Data.
Description
The package provides a function to automatically import Brazilian CODID-19 pandemic data into R. Brazilian data is available on the country, region, state, and city levels, and are obtained from the official Brazilian repository at <https://covid.saude.gov.br/>. The package also downloads the world-level COVID-19 data from the John Hopkins University's repository at <https://github.com/CSSEGISandData/COVID-19>.
Author(s)
Fábio N. Demarqui, Cristiano C. Santos, and Matheus B. Costa. _PACKAGE
Adding incidence, mortality and lethality rates to the downloaded data
Description
This function adds the incidence, mortality and lethality rates to a given data set downloaded by the covid19br::downloadCovid19() function.
Usage
add_epi_rates(data, ...)
Arguments
data |
a data set downloaded using the covid19br::downloadCovid19() function. |
... |
further arguments passed to other methods. |
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.
Value
the data set with the added incidence, mortality and lethality rates.
Author(s)
Fabio N. Demarqui fndemarqui@est.ufmg.br
Examples
library(covid19br)
library(dplyr)
brazil <- downloadCovid19(level = "brazil")
brazil <- add_epi_rates(brazil)
glimpse(brazil)
Adding the geometry to the downloaded data for drawing maps
Description
This function adds the necessary geometry for drawing maps to a given data set downloaded by the covid19br::downloadCovid19() function.
Usage
add_geo(data, ...)
Arguments
data |
a data set downloaded using the covid19br::downloadCovid19() function. |
... |
further arguments passed to other methods. |
Details
The function add_geo() was designed to work with the original names of the variables available in the dataset downloaded by the covid19br::downloadCovid19(). For this reason, this function must be used before any changes in the original names of the variables.
The development human index (DHI) variables (see full description below) are available at city level, and their average are computed for state and region levels.
Data dictionary (Brazilian data):
region: regions' names
state: states' names.
city: cities' names.
DHI: development human index.
EDHI: educational development human index.
LDHI: longevity development human index.
IDHI: income development human index.
pop: estimated population in 2019.
region_code: numerical code attributed to regions
state_code: numerical code attributed to states
mesoregion_code: numerical code attributed to mesoregions
microregion_code: numerical code attributed to microregions
city_code: numerical code attributed to cities
geometry: georeferenced data needed to plot maps.
area: area (in Km^2)
demoDens: demographic density.
Data dictionary (world data):
country: country's name
continent: continent's name
region: regions' names
subregion: subregion's name
pop: estimated population
pais: country's name in Portuguese
country_code: numerical code attributed to countries
continent_code: numerical code attributed to continents
region_code: numerical code attributed to regions
subregion_code: numerical code attributed to subregions
geometry: georeferenced data needed to plot maps.
Value
the data set with the added georeferenced data.
Author(s)
Fabio N. Demarqui fndemarqui@est.ufmg.br
Source
World map: https://CRAN.R-project.org/package=rnaturalearthdata
Shapefiles for Brazilian maps: https://www.ibge.gov.br/geociencias/downloads-geociencias.html
Brazilian DHI data: https://github.com/ipea/IpeaGeo
Examples
library(covid19br)
library(dplyr)
regions <- downloadCovid19(level = "regions")
regions_geo <- add_geo(regions)
glimpse(regions_geo)
Function to download COVID-19 data from web repositories
Description
This function downloads the pandemic COVID-19 data at Brazil and World levels. Brazilian data is available at national, region, state, and city levels, whereas the world data are available at the country level.
Usage
downloadCovid19(level = c("brazil", "regions", "states", "cities", "world"))
Arguments
level |
the desired level of data aggregation: "brazil" (default), "regions", "states", "cities", and "world". |
Details
Data dictionary (variables commum to brazilian and world data):
date: date of data registry
epi_week: epidemiological week
pop: estimated population
accumCases: accumulative number of confirmed cases
newCases: daily count of new confirmed cases
accumDeaths: accumulative number of deaths
newDeaths: daily count of new deaths
newRecovered: daily count of new recovered patients
Data dictionary (variables in the brazilian data):
region: regions' names
state: states' names.
city: cities' names.
state_code: numerical code attributed to states
city_code: numerical code attributed to cities
healthRegion_code: health region code
healthRegion: heald region name
newFollowup: daily count of new patients under follow up
metro_area: indicator variable for city localized in a metropolitan area
capital: indicator variable for capital of brazilian states
Data dictionary (variables in the world data):
country: countries' names
accumRecovered: accumulative number of recovered patients
Value
a tibble containing the downloaded data at the specified level.
Examples
library(covid19br)
# Downloading Brazilian COVID-19 data:
brazil <- downloadCovid19(level = "brazil")
regions <- downloadCovid19(level = "regions")
states <- downloadCovid19(level = "states")
cities <- downloadCovid19(level = "cities")
# Downloading world COVID-19 data:
world <- downloadCovid19(level = "world")
Results of the 2018 presidential election in Brazil by city.
Description
Dataset containing the results of the 2018 presidential election in Brazil.
Format
A data frame with 5570 rows and 6 variables:
region: regions' names
state: states' names.
city: cities' names.
region_code: numerical code attributed to regions
state_code: numerical code attributed to states
mesoregion_code: numerical code attributed to mesoregions
microregion_code: numerical code attributed to microregions
city_code: numerical code attributed to cities
Bolsonaro: count of votes obtained by the President-elected Jair Bolosnaro.
Haddad: count of votes obtained by the defeated candidate Fernando Haddad.
pop: estimated population in 2019.
Author(s)
Fabio N. Demarqui fndemarqui@est.ufmg.br
Source
Tribunal Superior Eleitoral (TSE). URL: https://www.tse.jus.br/eleicoes/estatisticas.
Results of the 2018 presidential election in Brazil by region.
Description
Dataset containing the results of the 2018 presidential election in Brazil.
Format
A data frame with 5 rows and 4 variables:
region: regions' names.
Bolsonaro: count of votes obtained by the President-elected Jair Bolosnaro.
Haddad: count of votes obtained by the defeated candidate Fernando Haddad.
pop: estimated population in 2019.
Author(s)
Fabio N. Demarqui fndemarqui@est.ufmg.br
Source
Tribunal Superior Eleitoral (TSE). URL: https://www.tse.jus.br/eleicoes/estatisticas.
Results of the 2018 presidential election in Brazil by state.
Description
Dataset containing the results of the 2018 presidential election in Brazil.
Format
A data frame with 27 rows and 5 variables:
region: regions' names.
state: states' names.
Bolsonaro: count of votes obtained by the President-elected Jair Bolosnaro.
Haddad: count of votes obtained by the defeated candidate Fernando Haddad.
pop: estimated population in 2019.
Author(s)
Fabio N. Demarqui fndemarqui@est.ufmg.br
Source
Tribunal Superior Eleitoral (TSE). URL: https://www.tse.jus.br/eleicoes/estatisticas.
City-level georeferenced data
Description
Data set obtained from the Instituto Brasileiro de Geografia e Estatística (IBGE) with data on the Brazilian population and geographical information on city level.
Format
A data frame with 5570 rows and 16 variables:
region: regions' names
state: states' names.
city: cities' names.
DHI: development human index.
EDHI: educational development human index.
LDHI: longevity development human index.
IDHI: income development human index.
pop: estimated population in 2019.
region_code: numerical code attributed to regions
state_code: numerical code attributed to states
mesoregion_code: numerical code attributed to mesoregions
microregion_code: numerical code attributed to microregions
city_code: numerical code attributed to cities
geometry: georeferenced data needed to plot maps.
area: area (in Km^2)
pop_dens: demographic density.
Details
The development human index (DHI) variables are available at city level, and their average are computed for state and region levels.
Author(s)
Fabio N. Demarqui fndemarqui@est.ufmg.br
Source
Shapefiles for Brazilian maps: https://www.ibge.gov.br/geociencias/downloads-geociencias.html
Brazilian DHI data: https://github.com/ipea/IpeaGeo
Region-level georeferenced data
Description
Data set obtained from the Instituto Brasileiro de Geografia e Estatística (IBGE) with data on the Brazilian population and geographical information on region level.
Format
A data frame with 5 rows and 10 variables:
region: regions' names
DHI: development human index.
EDHI: educational development human index.
LDHI: longevity development human index.
IDHI: income development human index.
pop: estimated population in 2019.
region_code: numerical code attributed to regions
geometry: georeferenced data needed to plot maps.
area: area (in Km^2)
pop_dens: demographic density.
Details
The development human index (DHI) variables are available at city level, and their average are computed for state and region levels.
Author(s)
Fabio N. Demarqui fndemarqui@est.ufmg.br
Source
Shapefiles for Brazilian maps: https://www.ibge.gov.br/geociencias/downloads-geociencias.html
Brazilian DHI data: https://github.com/ipea/IpeaGeo
State-level georeferenced data
Description
Data set obtained from the Instituto Brasileiro de Geografia e Estatística (IBGE) with data on the Brazilian population and geographical information on state level.
Format
A data frame with 27 rows and 12 variables:
region: regions' names
state: states' names.
DHI: development human index.
EDHI: educational development human index.
LDHI: longevity development human index.
IDHI: income development human index.
pop: estimated population in 2019.
region_code: numerical code attributed to regions
state_code: numerical code attributed to states
geometry: georeferenced data needed to plot maps.
area: area (in Km^2)
pop_dens: demographic density.
Details
The development human index (DHI) variables are available at city level, and their average are computed for state and region levels.
Author(s)
Fabio N. Demarqui fndemarqui@est.ufmg.br
Source
Shapefiles for Brazilian maps: https://www.ibge.gov.br/geociencias/downloads-geociencias.html
Brazilian DHI data: https://github.com/ipea/IpeaGeo
World-level georeferenced data
Description
Data set containing the world population and geographical information on country level.
Format
A data frame with 241 rows and 11 variables:
country: country's name.
continent: continent's name.
region: regions' names.
subregion: subregion's name.
pop: estimated population.
pais: country's name in Portuguese.
country_code: numerical code attributed to countries.
continent_code: numerical code attributed to continents.
region_code: numerical code attributed to regions.
subregion_code: numerical code attributed to subregions.
geometry: georeferenced data needed to plot maps.
Author(s)
Fabio N. Demarqui fndemarqui@est.ufmg.br