-
Notifications
You must be signed in to change notification settings - Fork 0
/
ltla-tests.R
48 lines (34 loc) · 969 Bytes
/
ltla-tests.R
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
## ltla data
library(tidyverse)
library(lubridate)
ltla <- read_ods("data/P2_tests_processed_LTLA_w21.ods", sheet = 2)
ltla <- ltla %>%
mutate(`29/06/20` = as.numeric(`29/06/20`)) %>%
pivot_longer(names_to = "date", values_to = "value", cols = 7:ncol(.))
ltla$date %>%
unique()
totals <- ltla %>%
filter(date == "Total since Test and Trace launched")
dated <- ltla %>%
filter(date != "Total since Test and Trace launched")
date1 <- dated %>%
mutate(date = paste0(date, "20"),
date = lubridate::dmy(date))
View(date1)
date1 %>%
filter(`LTLA Name` == "ENGLAND") %>%
ggplot(aes(date, value)) +
geom_line() +
geom_smooth()
areas <- pull(dated, "LTLA Name") %>%
unique()
plot_tests <- function(area) {
g <- date1 %>%
filter(`LTLA Name`== area) %>%
ggplot(aes(date, value)) +
geom_line() +
geom_smooth(method = "gam") +
ggtitle(paste0("Daily tests in ", area))
print(g)
}
plot_tests(area = areas[158])