-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcovid19R.Rmd
83 lines (62 loc) · 3.18 KB
/
covid19R.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
# The Covid19R Package
The [covid19R package](https://github.com/Covid19R/covid19R) is written to access the data collected by packages that are part of the Covid19R project. It has minimal dependencies, and does not require you to install any of the other data access packages. Rather, it queries our building database of standardized tidy datasets, allowing you to search what is available, and then directly download the datasets that have been updated in the previous 6 hours.
```{r prep, include=FALSE}
library(knitr)
knitr::opts_chunk$set(warning = FALSE, message=FALSE)
```
```{r cr19}
library(covid19R)
#for examples
library(dplyr)
```
## Finding out what data we have with get_covid19_data_info()
To see what data is available, `get_covid19_data_info()` returns a tibble of all data sets that are available, as well as information about each. This is the same information that individual data packages have returned with their own `get_info_*()` functions discussed in [Standardized Package Functions]. In addition, it provides information on when the data was last updated, and if the data package is currently able to acquire data, or is failing.
Here is what we have at the time of writing this documentation.
```{r dat}
dat_info <- get_covid19_data_info()
dat_info %>%
knitr::kable() %>%
kableExtra::kable_styling(
bootstrap_options = c("striped","condensed", "responsive")) %>%
kableExtra::scroll_box(width = "100%", height = "100%")
```
The data can be easily filtered on to find the data most relevant to your effort, such as
```{r filter_info}
dat_info %>%
filter(stringr::str_detect(location_types, "state")) %>%
select(data_set_name, data_details) %>%
knitr::kable() %>%
kableExtra::kable_styling(
bootstrap_options = c("striped","condensed", "responsive")) %>%
kableExtra::scroll_box(width = "100%", height = "100%")
```
## Downloading a dataset with get_covid19_dataset()
Once you have determined the relevant dataset you want, you can download it with `get_covid19_dataset()`. For example
```{r ex, message=FALSE}
nytimes_states <- get_covid19_dataset("covid19nytimes_states")
nytimes_states %>%
head() %>%
knitr::kable(format = "html") %>%
kableExtra::kable_styling(
bootstrap_options = c("striped","condensed", "responsive"))
```
## Examining controlled vocabulary with get_covid19_controlled_vocab()
In our data standard, we have three types of controlled vocabulary - `location_type`, `location_code_type`, and `data_type`. To see what the current controlled vocabulary is (both to understand the fields and to see if we should add more), use `get_covid19_controlled_vocab()` as below:
```{r voc}
get_covid19_controlled_vocab("location_type") %>%
knitr::kable(format = "html") %>%
kableExtra::kable_styling(
bootstrap_options = c("striped","condensed", "responsive"))
```
```{r voc_code}
get_covid19_controlled_vocab("location_code_type") %>%
knitr::kable(format = "html") %>%
kableExtra::kable_styling(
bootstrap_options = c("striped","condensed", "responsive"))
```
```{r voc_dat}
get_covid19_controlled_vocab("data_type") %>%
knitr::kable(format = "html") %>%
kableExtra::kable_styling(
bootstrap_options = c("striped","condensed", "responsive"))
```