-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoa-dashboard.Rmd
248 lines (201 loc) · 8.28 KB
/
oa-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
---
title: "OA Dashboard"
author: "Tom Saunders"
output:
html_document:
css: "style.css"
knit: (function(inputFile, encoding) { rmarkdown::render(inputFile, encoding = encoding, output_file = file.path(dirname(inputFile), 'index.html')) })
---
```{r, echo=FALSE, message=FALSE, warning=FALSE}
knitr::opts_chunk$set(
echo=FALSE,
warning=FALSE,
message=FALSE,
fig.align="center"
)
library(tidyverse)
```
This dashboard displays access type data for the scholarly publication output of all 8 Aotearoa New Zealand universities to track progress towards the Universities New Zealand [target](https://www.universitiesnz.ac.nz/sites/default/files/uni-nz/documents/Open%20Access%20Statement.pdf) of 70% open access output by 2025. It also includes data from the Group of 8 Australian universities to examine how our two countries compare.
Data is extracted from OpenAlex via the API to examine access trends since 2010 using two queries:
* [This query](https://github.com/tesaunders/oa-nz/blob/main/query-overall.R) extracts data relating to the overall access trend for both sets of universities.
* [This query](https://github.com/tesaunders/oa-nz/blob/main/query-institution.R) extracts data relating to individual universities.
All code, plots, and summarised data can be found [here](https://github.com/tesaunders/oa-nz).
## Overall Data
```{r, fig.dim = c(8, 6)}
# Get previous year
prev_year <- as.numeric(format(Sys.Date(), "%Y"))-1
# Read in data generated by both queries
data_overall_nz <- read_csv("data/overall_nz.csv") |>
mutate(country = "nz")
data_overall_au <- read_csv("data/overall_au.csv") |>
mutate(country = "au")
data_institutions_nz <- read_csv("data/institutions_nz.csv") |>
mutate(country = "nz")
data_institutions_au <- read_csv("data/institutions_au.csv") |>
mutate(country = "au")
data_overall <- rbind(data_overall_nz, data_overall_au)
data_institutions <- rbind(data_institutions_nz, data_institutions_au)
# Summarise and plot overall trend data
overall_trend <- data_overall |>
mutate(
open = case_when(oa_type != "closed" ~ "open", .default = oa_type),
) |>
group_by(year, open, country) |>
summarise(
pc = sum(pc),
) |>
filter(open == "open")
ggplot(overall_trend, aes(x = year, y = pc)) +
geom_line(data = overall_trend |> filter(country == "nz"), size = 1, aes(colour = "NZ")) +
geom_line(data = overall_trend |> filter(country == "au"), size = 1, aes(colour = "AU")) +
theme_classic() +
scale_color_manual(name = "Country",
values = c("NZ" = "black",
"AU" = "gold")) +
xlab("") +
ylab("%") +
ylim(0, 80) +
scale_x_continuous(n.breaks = prev_year-2010) +
ggtitle(paste0("Open Access Publication Output, 2010-", prev_year))
ggsave("fig/1-overall-trend.png")
# Plot break down of access type
data_overall$oa_type <- factor(data_overall$oa_type,
levels = c("bronze","green", "hybrid", "gold", "diamond", "closed"))
ggplot(data_overall, aes(x = year, y = pc, fill = oa_type)) +
geom_bar(data = data_overall |> filter(country == "nz"),
position = "dodge", stat = "identity") +
scale_fill_manual(name = "Access Type",
values = c("bronze" = "#A65628",
"hybrid" = "#377EB8",
"gold" = "#FFFF33",
"diamond" = "lightgrey",
"green" = "#4DAF4A",
"closed" = "#E41A1C")) +
theme_classic() +
xlab("") +
ylab("%") +
scale_x_continuous(n.breaks = prev_year-2010) +
ggtitle(paste0("Access Status for New Zealand Research Publications, 2010-", prev_year))
ggsave("fig/2-overall-types-nz.png")
ggplot(data_overall, aes(x = year, y = pc, fill = oa_type)) +
geom_bar(data = data_overall |> filter(country == "au"),
position = "dodge", stat = "identity") +
scale_fill_manual(name = "Access Type",
values = c("bronze" = "#A65628",
"hybrid" = "#377EB8",
"gold" = "#FFFF33",
"diamond" = "lightgrey",
"green" = "#4DAF4A",
"closed" = "#E41A1C")) +
theme_classic() +
xlab("") +
ylab("%") +
scale_x_continuous(n.breaks = prev_year-2010) +
ggtitle(paste0("Access Status for Australian Research Publications, 2010-", prev_year))
ggsave("fig/2-overall-types-au.png")
```
## Comparison of Institutions {.tabset}
### Open status over time
```{r, fig.dim = c(8, 60)}
data_institutions_sum <- data_institutions |>
mutate(
open = case_when(oa_type != "closed" ~ "open", .default = oa_type),
) |>
group_by(year, institution, open) |>
summarise(
pc = sum(pc),
)
plot_function_open <- function(data_institutions_sum) {
p <- ggplot(data_institutions_sum, aes(x = year, y = pc, colour = open))
p <- p + geom_line(size = 1) +
scale_colour_manual(name = "Access Type",
values = c("open" = "#4DAF4A",
"closed" = "#E41A1C")) +
theme_classic() +
xlab("") +
ylab("%") +
ylim(0, 80) +
scale_x_continuous(n.breaks = prev_year-2010) +
ggtitle(paste0("Open Access Publication Output for ",
data_institutions_sum$institution[1],
", 2010-", prev_year))
return(p)
}
plot_list <- data_institutions_sum |>
group_by(institution) |>
group_split(institution) |>
map(~ plot_function_open(.x))
wrapped_plot <- patchwork::wrap_plots(plot_list, ncol = 1)
nb_plots <- length(plot_list)
baseheight <- grDevices::dev.size(units = "px")[1]
ggsave("fig/3-institutions-all.png",
wrapped_plot,
height = nb_plots * baseheight,
units = "px",
limitsize = FALSE)
wrapped_plot
```
### Access type over time
```{r, fig.dim = c(8, 60)}
plot_function_type <- function(data_institutions) {
p <- ggplot(data_institutions, aes(x = year, y = pc, colour = oa_type))
p <- p + geom_line(size = 1) +
scale_colour_manual(name = "Access Type",
values = c("bronze" = "#A65628",
"hybrid" = "#377EB8",
"gold" = "#FFFF33",
"diamond" = "lightgrey",
"green" = "#4DAF4A",
"closed" = "#E41A1C")) +
theme_classic() +
xlab("") +
ylab("%") +
ylim(0, 80) +
scale_x_continuous(n.breaks = prev_year-2010) +
ggtitle(paste0("Access Type Trend for ",
data_institutions$institution[1],
", 2010-", prev_year))
return(p)
}
plot_list_type <- data_institutions |>
group_by(institution) |>
group_split() |>
map(~ plot_function_type(.x))
wrapped_plot_type <- patchwork::wrap_plots(plot_list_type, ncol = 1)
nb_plots_type <- length(plot_list_type)
ggsave("fig/4-institutions-type.png",
wrapped_plot_type,
height = nb_plots_type * baseheight,
units = "px",
limitsize = FALSE)
wrapped_plot_type
```
### Access type for most recent year
```{r, fig.dim = c(8, 6)}
institutions_access <- data_institutions |>
filter(year == prev_year)
order_closed <- institutions_access |>
filter(oa_type == "closed") |>
arrange(desc(pc)) |>
select(institution)
institutions_access$institution <- factor(institutions_access$institution,
levels = pull(order_closed, institution))
institutions_access$oa_type <- factor(institutions_access$oa_type,
levels = c("bronze","green", "hybrid", "gold", "diamond", "closed"))
ggplot(institutions_access, aes(x = institution, y = pc, fill = oa_type)) +
geom_bar(position = "dodge", stat = "identity") +
scale_fill_manual(name = "Access Type",
values = c("bronze" = "#A65628",
"hybrid" = "#377EB8",
"gold" = "#FFFF33",
"diamond" = "lightgrey",
"green" = "#4DAF4A",
"closed" = "#E41A1C")) +
coord_flip() +
theme_classic() +
xlab("") +
ylab("%") +
ggtitle(paste0("Access Type by Institution, ", prev_year))
ggsave("fig/5-institutions-type-now.png")
```
## {.unnumbered}