-
Notifications
You must be signed in to change notification settings - Fork 0
/
Summary.Rmd
58 lines (52 loc) · 1.55 KB
/
Summary.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
---
title: "Weekly Testing Dataset Summary"
author: "Cam Appel"
date: "03/04/2021"
output: md_document
---
# Weekly Testing Dataset Summary `r Sys.Date()`
```{r, echo=FALSE, warning=FALSE,message=FALSE}
library(readr)
library(lubridate)
library(dplyr)
# inactive countries
data <- read_csv(url("https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/testing/covid-testing-all-observations.csv")) %>%
select(1, 3, 4) %>%
group_by(Entity) %>%
summarise(max(Date), `Source URL` = first(`Source URL`), Counts=n())
data['active'] <- NA
for (i in 1:nrow(data)) {
if(data[[i,2]] > Sys.Date()-21) {
data$active[[i]] = "active"
} else {
data$active[[i]] = "inactive"
}
}
inactive <- filter(data, active == "inactive")
names(inactive)[2] <- 'Last updated'
inactive <- inactive[, c(1,2,3,4)]
inactive <- inactive[order(inactive$`Last updated`),]
# missing countries
# df_loc <- data
# df_loc$Entity <- gsub("[^ ][^-]*$","",data$Entity) %>%
# trimws()
# df_pop <- read_csv("https://raw.githubusercontent.com/owid/covid-19-data/master/scripts/input/un/population_2020.csv")
#
# miss <- list()
#
# for (i in df_pop$entity) {
# match <- i %in% df_loc$Entity
# if(!match) {
# miss[[length(miss)+1]] <- i
# }
# }
```
## Out of date countries:
```{r echo=FALSE}
knitr::kable(inactive)
```
## Missing countries:
```{r echo=FALSE}
# cat(paste('-',miss),sep='\n')
```
<iframe src="https://ourworldindata.org/grapher/countries-included-in-the-covid-19-testing-dataset" loading="lazy" style="width: 100%; height: 600px; border: 0px none;"></iframe>