Skip to content

Instantly share code, notes, and snippets.

@jtrecenti
Created March 17, 2020 23:25
Show Gist options
  • Save jtrecenti/9ed617e060c2b01cfe9cce32577bf9b5 to your computer and use it in GitHub Desktop.
Save jtrecenti/9ed617e060c2b01cfe9cce32577bf9b5 to your computer and use it in GitHub Desktop.
Ler dados do novo corona virus a partir da base disponibilizada pelo Ministério da Saúde
library(magrittr)
dados <- "http://plataforma.saude.gov.br/novocoronavirus/resources/scripts/database.js" %>%
readr::read_file() %>%
stringr::str_remove("var database=") %>%
jsonlite::fromJSON() %>%
purrr::pluck("brazil") %>%
dplyr::mutate(values = purrr::map(values, dplyr::mutate_all, as.character)) %>%
tidyr::unnest(values) %>%
dplyr::mutate(date = lubridate::dmy(date))
dplyr::glimpse(dados)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment