mort_geral/script/mort_am_lat.Rmd

61 lines
1.3 KiB
Plaintext
Executable File

---
title: "Mortalidade geral Brasil e outros países 2000-2018"
author: "José A Bran - https://ayuda.onecluster.org/"
date: "2021-04-22"
output:
flexdashboard::flex_dashboard:
storyboard: true
vertical_layout: fill
source_code: embed
social: menu
---
```{r setup, include=FALSE}
library(flexdashboard)
library(WDI)
library(ggplot2)
library(data.table)
library(DT)
library(plotly)
```
Mortalidade por 1000 habitantes
=======================================================================
Mortalidade por 1000 habitantes para alguns países da América Latina
Informações extraídas da API de indicadores mundiais de desenvolvimento
do Banco Mundial:
https://databank.worldbank.org/source/world-development-indicators
```{r}
df <- WDI(indicator = 'SP.DYN.CDRT.IN',
country = c("CO", "CU", "AR", "BO", "BR",
"PE", "MX", "UY", "PY", "EC"),
start = 2000, end = 2022)
setDT(df)
setnames(df, "SP.DYN.CDRT.IN", "Death
```
```{r }
datatable(df, filter = 'top') |>
formatRound('Death rate', 1)
```
Gráfico América Latina
=======================================================================
```{r, message=FALSE}
p <- ggplot(df, aes(year, `Death rate`, col = country)) +
geom_line() +
theme_bw() +
labs(y = "Mortalidade x 1000 habitantes")
```
```{r }
ggplotly(p)
```