-
Notifications
You must be signed in to change notification settings - Fork 0
/
04_Dashboard.Rmd
257 lines (200 loc) · 8.95 KB
/
04_Dashboard.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
---
title: "Exploring European conservation planning studies"
output:
flexdashboard::flex_dashboard:
storyboard: true
social: menu
theme:
version: 4
bootswatch: flatly
---
```{r setup, include=FALSE, warning=FALSE, echo=FALSE}
library(flexdashboard)
library(ggthemes)
library(scico)
library(tidyverse)
library(ggplot2)
library(sf)
library(plotly)
library(leaflet)
```
```{r Load data, include=FALSE, warning=FALSE, message=FALSE}
# Load in formatted literature extract
df <- readRDS("resSaves/literature_formatted.rds")
# Load in formatted citation data
cit <- readRDS("resSaves/citation_extraction_formatted.rds") |> dplyr::select(-date)
# And location information
locations <- readRDS("resSaves/location_match.rds")
terrestrial <- st_read("extdata/TerrestrialRegions.gpkg", quiet = TRUE) |>
filter(!SOVEREIGNT %in% c("Iceland", "Moldova"))
marine <- st_read("extdata/MarineRegions.gpkg", quiet = TRUE) |>
filter(!(GEONAME %in% c("Jan Mayen Exclusive Economic Zone","Joint regime area Iceland / Norway (Jan Mayen)",
"Icelandic Exclusive Economic Zone",
"Greenlandic Exclusive Economic Zone")))
```
### Spatial coverage of the studies across varying scale
```{r Prepare data and render spatial density}
o <- df
o$Region[o$Region=="Mediteranean"] <- "Mediterranean"
# assertthat::assert_that(!anyNA(o$Region))
## Marine - Convert Macro-regions into countries
o$Region[o$Realm=="Marine" & o$Region=="Mediterranean"] <-
"Spain, France, Italy, Croatia, Greece, Cyprus, Malta, Monaco, Montenegro, Albania, Bosnia and Herzegovina, Slovenia"
o$Region[o$Realm=="Marine" & o$Region=="Adriatic-Ionian Region"] <-
"Italy, Croatia, Slovenia, Greece, Montenegro, Albania, Bosnia and Herzegovina"
## Terrestrial macro-regions
o$Region[o$Realm=="Terrestrial" & o$Region =="Mediterranean"] <-
"Spain, France, Italy, Croatia, Greece, Cyprus, Morocco, Vatican, Northern Cyprus, Cyprus No Mans Area, San Marino, Andorra, Portugal, Vatican, Malta, Monaco, Montenegro, Albania, Bosnia and Herzegovina, Slovenia"
o$Region[o$Realm=="Terrestrial" & o$Region =="Alpes"] <-
"Austria, Switzerland"
o$Region[o$Realm=="Terrestrial" & o$Region == "Danube catchment"] <-
"Austria, Bulgaria, Hungary, Romania, Germany, Croatia"
# For European studies
o$Region[o$Region=="Europe" & o$Realm=="Marine"] <- paste0(unique(marine$SOVEREIGN1), collapse = ", ")
o$Region[o$Region=="Europe" & o$Realm=="Terrestrial"] <- paste0(unique(terrestrial$SOVEREIGNT),collapse = ", ")
# Split by region
o <- tidyr::separate_rows(df, Region)
# Merge with terrestrial and marine shapefiles
# TODO:
# In the mean time, render the raster
# Load terra raster
library(raster)
library(scico)
ras <- raster("resSaves/AggregatedNumberStudies.tif")
pal <- colorNumeric(palette = scico(100, palette = "hawaii", direction = -1),
values(ras), na.color = "transparent")
# --- #
# Leaflet rendering
leaflet() |>
addProviderTiles("Stamen.TonerHybrid") |>
addTiles() |>
addRasterImage(ras,colors = scico(100, palette = "hawaii", direction = -1), opacity = 0.8) |>
addLegend(pal = pal, values = values(ras),
title = "Number of studies")
```
***
- Spatial overview of published conservation plannning studies
- Most conservation planning studies published in Finland, Spain and Italy
- Terrestrial studies were more common than marine or freshwater
- Local and national studies predominant
### Searchable table of all studies found through the review
```{r Prepare data and visualize as searchable table}
# Split up the country
o <- df |>
dplyr::select(-Reviewer, -Suitable) |>
# Select relevant tables
dplyr::select(Extent:Stakeholder.involvement,
Year, Title, DOI, newDOI) |>
# Joining in citations
dplyr::full_join(cit |> dplyr::select(-crossref_citationcount), by = c("newDOI" = "doi")) |>
dplyr::select(-newDOI) |>
distinct()
DT::datatable(o,
rownames = TRUE,
style = 'auto', # 'bootstrap4'
# Filter
filter = list(position = 'top', clear = TRUE, plain = TRUE),
plugins = c("select", "searchHighlight"),
options = list(
pageLength = 25
))
```
### Timeline of published studies by Extent
```{r}
library(dygraphs)
o <- df |> dplyr::group_by(Extent, Year) |> summarise(N = n()) |> arrange(Year) |>
tidyr::pivot_wider(names_from = Extent, values_from = N)
dygraph(o, main = "Local conservation planning studies\nremain the most common",xlab = "Number of studies (N)") %>%
dySeries("Local", label = "Local",color = "orange") %>%
dySeries("National", label = "National",color = "lightblue") %>%
dySeries("Regional", label = "Regional",color = "violet") %>%
dySeries("Europe", label = "Europe",color = "red") %>%
dyOptions(stackedGraph = TRUE) %>%
dyRangeSelector(height = 20) %>%
dyRangeSelector()
```
### Timeline of published studies by Method
```{r}
library(dygraphs)
o <- df |>
dplyr::mutate(Method = make.names(stringr::str_trim(Method))) |>
dplyr::mutate(Method = forcats::fct_collapse(Method, Overlay.Others = c("GIS.Overlay", "Other"))) |>
dplyr::group_by(Method, Year) |> summarise(N = n()) |> arrange(Year) |>
tidyr::pivot_wider(names_from = Method, values_from = N)
dygraph(o, main = "Overlays and scoring method\n continue to be used for planning",xlab = "Number of studies (N)") %>%
dySeries("Overlay.Others", label = "Overlays",color = "orange") %>%
dySeries("Marxan.", label = "Marxan",color = "lightblue") %>%
dySeries("Zonation", label = "Zonation",color = "violet") %>%
dySeries("Integer.programming", label = "Integer.programming",color = "red") %>%
dyOptions(stackedGraph = TRUE) %>%
dyRangeSelector(height = 20) %>%
dyRangeSelector()
```
### Common complexity properties of the reviewed studies {data-commentary-width=200}
```{r}
# Summarize different properties
# Period
o1 <- df |> drop_na(Planning.purpose) |>
dplyr::mutate(Period = forcats::fct_collapse(Period, Future = c("Future", "Both"))) |>
count(Planning.purpose, Period) |>
rename(var1 = Planning.purpose, var2 = Period) |>
group_by(var1) |> mutate(prop = prop.table(n)) |> mutate(type = "Period")
# Multiple objectives
o2 <- df |> drop_na(Planning.purpose) |> count(Planning.purpose, Multiple.objectives.or.constraints) |>
rename(var1 = Planning.purpose, var2 = Multiple.objectives.or.constraints) |>
group_by(var1) |> mutate(prop = prop.table(n)) |> mutate(type = "Land use")
# Connectivity
o3 <- df |> drop_na(Planning.purpose) |> count(Planning.purpose, Connectivity) |>
rename(var1 = Planning.purpose, var2 = Connectivity) |>
group_by(var1) |> mutate(prop = prop.table(n)) |> mutate(type = "Connectivity")
# Stakeholder involvement
o4 <- df |> drop_na(Planning.purpose) |> count(Planning.purpose, Stakeholder.involvement) |>
rename(var1 = Planning.purpose, var2 = Stakeholder.involvement) |>
group_by(var1) |> mutate(prop = prop.table(n)) |> mutate(type = "Stakeholder involvement")
# Combine them all
o <- bind_rows(o1,o2,o3,o4)
o$var2 <- forcats::fct_collapse(o$var2, None = c("None", "no"))
o$var2 <- forcats::fct_collapse(o$var2, Included = c("yes"))
p1 <- ggplot(o |> dplyr::rename(Purpose = var1, variable = var2),
aes(x = Purpose, y = n, fill = variable)) +
theme_base(base_size = 14) +
geom_bar(stat = "identity",position = position_dodge(.5)) +
scale_fill_stata() +
facet_wrap(~type, as.table = TRUE) +
guides(fill = guide_legend(title = "")) +
theme(legend.position = "bottom",
axis.text.x.bottom = element_text(angle = 60, hjust = 1,size = 8)) +
labs(y = "Number of studies", x = "")
p1
ggplotly(p1)
```
***
- Structural and boundary connectivity constraints are mostly applied in priority setting
- The use of costs for common for accounting for different land uses, while multi-objective optimizations is more prevalent for planning for management actions.
- Future conditions of features or other elements of the planning are rarely considered.
- Stakeholders are rarely included across all types of studies
### Average number of citations per Extent
```{r}
# Format DOI
df$newDOI <- stringr::str_replace_all(df$DOI, "http://dx.doi.org/","")
df$newDOI <- str_replace_all(df$newDOI, "https://dx.doi.org/","")
df$newDOI <- str_replace_all(df$newDOI, "Https://dx.doi.org/","")
df$newDOI <- str_replace_all(df$newDOI, "https://doi.org/","")
df$newDOI <- str_replace_all(df$newDOI, "https://","")
o <- dplyr::left_join(df, cit, by = c("newDOI" = "doi") )
# Filter
oo <- o |> tidyr::drop_na(Extent) |>
dplyr::select(Extent, cite_scientific, cite_policy) |>
tidyr::pivot_longer(cols = -1,names_to = "Type")
oo$Type <- factor(oo$Type, c("cite_scientific","cite_policy"),
labels = c("Scientific", "Policy"))
g1 <- ggplot(oo,
aes(x = Extent, y = value),
fill = Type) +
theme_base(base_size = 14) +
geom_boxplot() +
scale_fill_tableau() +
facet_wrap(~Type, nrow = 1, scales = "free") +
labs(y = "Number of citations", x = "")
ggplotly(g1)
```