-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCovid_Exposure_ACT_backup.Rmd
124 lines (91 loc) · 3.16 KB
/
Covid_Exposure_ACT_backup.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
title: "Covid19 exposure locations in the ACT"
resource_files:
- data/last.csv
#runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
params:
lup: "unknown"
---
```{r setup, include=TRUE}
library(tidyverse)
library(ggmap)
library(leaflet)
library(plotly)
library(flexdashboard)
library(DT)
#latest dataset
tab3 <- read.csv("data/last.csv")
# Aggregate method
cols <-c("yellow", "red", "blue")
cc <- as.numeric(factor(tab3$Contact))
labs <- paste(tab3$Contact, tab3$Status,tab3$Exposure.Location, tab3$Street, tab3$Suburb, tab3$Date,tab3$Arrival.Time, tab3$Departure.Time, tab3$doubles, sep="<br/>")
###############################################
##plot the map
m <- leaflet() %>% addTiles()
m <- m %>% addCircleMarkers(lat=tab3$lat, lng=tab3$lon,popup = labs, weight=0.5, color = cols[cc], radius = 5 , fillOpacity = 0.8)
m <- m %>% addLegend("bottomright", labels = levels(factor(tab3$Contact)), colors = cols)
```
```{r title, results='asis'}
cat(paste0("# ", params$lup))
```
<sup>Disclaimer: This map shows the covid exposure locations in the ACT and is an **unofficial website** based on [official sources](https://www.covid19.act.gov.au/act-status-and-response/act-covid-19-exposure-locations). So if in doubt, refer to the [offical website](https://www.covid19.act.gov.au/act-status-and-response/act-covid-19-exposure-locations), which has now also an [**official map**](https://www.covid19.act.gov.au/act-status-and-response/act-covid-19-exposure-locations/map#Map-of-ACT-exposure-locations) included. Supported by Volunteers from the University of Canberra. Contacts: Bernd Gruber [[email protected]] & Anthony Davidson [[email protected]]</sup>
Column {data-width=450}
-----------------------------------------------------------------------
### Map of Exposure sites
```{r}
#checks
m
```
Column {data-width=350}
-----------------------------------------------------------------------
### Table
```{r}
dtt <-DT::datatable(tab3[,c(1,8,2:7)],
rownames = FALSE, options = list(pageLength = 50, ausoHideNavigation=TRUE,
initComplete = JS(
"function(settings, json) {",
"$(this.api().table().header()).css({'font-size': '50%'});",
"}"))) %>% DT::formatStyle(columns = 1:8, fontSize='70%')
dtt
```
```{r}
### Chart C
# names(tab3)
# glimpse(tab3)
# countSub <- as.data.frame(table(as.factor(tab3$Suburb)))
# names(countSub) <- c("Suburb", "Total Count")
#
#
# # ggplot(countSub) +
# # geom_point(aes(x = Var1, y = Freq, col = Status))
#
#
# locs <- select(tab3, lat, lon, Suburb)
#
# plotdat1 <- left_join(countSub, tab3, by = "Suburb")
#
# # length(unique(as.factor(tab3$Suburb)))
# tab4 <- tab3 %>%
# group_by(Suburb) %>%
# summarise(count = length(as.factor(Suburb)),
# lat = mean(lat),
# lon = mean(lon))
#
# tab5 <- tab4 %>%
# group_by(count)%>%
# arrange(desc = TRUE, .by_group = TRUE)
#
# # ,
#
# # glimpse(tab4)
# # glimpse(plotdat1)
# #filter on location
#
# ggplot(tab5) +
# geom_point(aes(x = Suburb, y = count), size = 3) +
# theme(axis.text.x = element_text(angle = 90))
```