knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The covid19nytimes package harvests the data made freely available by the New York Times. See https://www.nytimes.com/article/coronavirus-county-data-us.html for more.
You can install the released version of covid19nytimes from CRAN with:
``` {r install, eval=FALSE} install.packages("covid19nytimes")
Or the latest development version from [github](https://github.com/covid19R/covid19nytimes) ```r devtools::install_github("covid19R/covid19nytimes")
The package has the data from states and counties. The package comes with static data that was downloaded at the time of the last package update.
library(covid19nytimes) head(covid19nytimes_states_demo) %>% knitr::kable() head(covid19nytimes_counties_demo) %>% knitr::kable()
To get the most updated data, run the following functions
covid19nytimes_states <- refresh_covid19nytimes_states() covid19nytimes_counties <- refresh_covid19nytimes_counties()
The data follows the covid19R standard for tidy Covid-19 data. The data columns are as follows:
,
, and can be split by tidyr::separate()
, if you wish.fips_code
total_cases
and total_deaths
, cumulative measures of both.library(dplyr) library(ggplot2) covid19nytimes_states %>% filter(location %in% c("Washington", "New York", "Massachusetts", "Michigan", "Illinois")) %>% filter(data_type == "deaths_total") %>% ggplot(aes(x = date, y = value, color = location)) + geom_line() + theme_minimal(base_size=14) + scale_y_continuous()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.