-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathREADME.Rmd
88 lines (62 loc) · 3.2 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# covid19nytimes
<!-- badges: start -->
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-orange.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![CRAN status](https://www.r-pkg.org/badges/version/covid19nytimes)](https://CRAN.R-project.org/package=covid19nytimes)
[![Travis build status](https://travis-ci.org/Covid19R/covid19nytimes.svg?branch=master)](https://travis-ci.org/Covid19R/covid19nytimes)
<!-- badges: end -->
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.
## Installation
You can install the released version of covid19nytimes from [CRAN](https://CRAN.R-project.org) with:
``` {r install, eval=FALSE}
install.packages("covid19nytimes")
```
Or the latest development version from [github](https://github.com/covid19R/covid19nytimes)
```{r install_github, eval = FALSE}
devtools::install_github("covid19R/covid19nytimes")
```
## Data
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.
```{r data}
library(covid19nytimes)
head(covid19nytimes_states_demo) %>% knitr::kable()
head(covid19nytimes_counties_demo) %>% knitr::kable()
```
## Getting the Most Up to Date Data
To get the most updated data, run the following functions
```{r refresh}
covid19nytimes_states <- refresh_covid19nytimes_states()
covid19nytimes_counties <- refresh_covid19nytimes_counties()
```
## Columns
The data follows the covid19R standard for tidy Covid-19 data. The data columns are as follows:
* date - The date in YYYY-MM-DD form
* location - The name of the location as provided by the data source. The counties dataset provides county and state. They are combined and separated by a `,`, and can be split by `tidyr::separate()`, if you wish.
* location_type - The type of location using the covid19R controlled vocabulary. Nested locations are indicated by multiple location types being combined with a `_
* location_code - A standardized location code using a national or international standard. In this case, FIPS state or county codes. See https://en.wikipedia.org/wiki/Federal_Information_Processing_Standard_state_code and https://en.wikipedia.org/wiki/FIPS_county_code for more
* location_code_type The type of standardized location code being used according to the covid19R controlled vocabulary. Here we use `fips_code`
* data_type - the type of data in that given row. Includes `total_cases` and `total_deaths`, cumulative measures of both.
* value - number of cases of each data type
## Sample visualization
```{r example_plot}
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()
```