-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstitutions.qmd
More file actions
257 lines (207 loc) · 7.33 KB
/
institutions.qmd
File metadata and controls
257 lines (207 loc) · 7.33 KB
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
257
---
title: "Institutions"
format: html
params:
refresh_investigator_data: true
refresh_volumes_sharing_data: true
save_volumes_sharing_status_info: true
csv_path: "private"
---
## About
This page provides information about Databrary's institutional partners.
For more information about institutional roles and responsibilities, see the [Databrary Guide](https://databrary.github.io/guide).
```{r}
#| label: set-up
#| echo: FALSE
#| message: FALSE
#| warning: FALSE
knitr::opts_chunk$set(echo = FALSE,
message = FALSE,
warning = FALSE)
suppressPackageStartupMessages(library(databraryr))
suppressPackageStartupMessages(library(tidyverse))
library(ggplot2)
# Source functions
fl <- list.files(file.path(here::here(), "R"), "*.R",
full.names = TRUE)
p <- purrr::map(fl, suppressPackageStartupMessages(source)) |>
purrr::quietly()
# Login to Databrary
x <- databraryr::login_db(email = Sys.getenv("USERNAME"),
password = Sys.getenv("PASSWORD"),
client_id = Sys.getenv("CLIENT_ID"),
client_secret = Sys.getenv("CLIENT_SECRET"),
store = FALSE,
overwrite = FALSE)
```
## Summary
```{r}
#| label: create-institution-affiliates-list
inst_affils_df <- make_inst_affil_df()
n_institutions <- length(unique(inst_affils_df$id))
```
Databrary has n=`{r} n_institutions` active institutional partners.
## Recent additions
```{r}
#| label: tbl-institutions-recent-additions
#| tbl-cap: "List of the 10 most recent additions to the network of Databrary institutions."
inst_affils_df |>
dplyr::arrange(desc(id)) |>
dplyr::select(name, institution_url) |>
dplyr::mutate(name = stringr::str_sub(name, start = 1, end = 25)) |>
head(n = 10) |>
kableExtra::kbl() |>
kableExtra::kable_material(full_width = F) |>
kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) |>
kableExtra::scroll_box(width = "700px")
```
## Full list
::: {.callout-warning}
This is a work-in-progress.
:::
Here is a full list in alphabetical order.
```{r}
#| label: tbl-databrary-institutions
#| tbl-cap: "List of all Databrary institutions in alphabetical order."
inst_affils_df |>
dplyr::select(name, institution_url) |>
dplyr::arrange(name) |>
dplyr::mutate(name = stringr::str_sub(name, start = 1, end = 25)) |>
kableExtra::kbl() |>
kableExtra::kable_material(full_width = F) |>
kableExtra:: kable_styling(bootstrap_options = c("striped", "hover")) |>
kableExtra:: scroll_box(width = "700px", height = "500px")
```
## Institutional participation
This section summarizes data about institutional participation in Databrary.
```{r}
#| label: import-inst-affils-data
inst_affils_df <- inst_affils_df |>
dplyr::group_by(id, name) |>
dplyr::summarise(n_ais = n())
```
```{r}
#| label: import-inst-shared-vols-data
inst_invest_shared_path <- file.path(params$csv_path, "inst_invest_shared")
inst_invest_shared_fl <- list.files(inst_invest_shared_path,
pattern = ".csv$",
full.names = TRUE)
inst_invest_shared <- purrr::map(inst_invest_shared_fl, readr::read_csv, show_col_types = FALSE) |>
purrr::list_rbind()
```
```{r}
#| label: clean-summarize-inst-affils-data
inst_invest_shared <- inst_invest_shared |>
dplyr::group_by(inst_id) |>
dplyr::rename(id = inst_id) |>
dplyr::summarise(
n_ais_w_vols = n(),
tot_n_vols = sum(n_vols),
tot_n_public = sum(n_public),
tot_n_overview = sum(n_overview)
) |>
dplyr::arrange(id)
inst_summ_df <- dplyr::left_join(inst_affils_df, inst_invest_shared, by = c("id"))
inst_summ_df <- inst_summ_df |>
dplyr::mutate(n_ais_w_vols = if_else(is.na(n_ais_w_vols), 0, n_ais_w_vols),
tot_n_vols = if_else(is.na(tot_n_vols), 0, tot_n_vols),
tot_n_public = if_else(is.na(tot_n_public), 0, tot_n_public),
tot_n_overview = if_else(is.na(tot_n_overview), 0, tot_n_overview))
```
### Tabular summaries
::: {.panel-tabset}
## Authorized Investigators
```{r}
#| label: tbl-institutional-footprint-ais
#| tbl-cap: "Institutions with the largest number of Authorized Investigators (n_ais). Also reported are the percent of authorized investigators who own publicly visible volumes (p_vols)."
#| eval: true
#| message: false
#| warning: false
inst_invest <- inst_summ_df[,c(2:4)]
inst_invest |>
# dplyr::select(name, n_ais, n_ais_w_vols) |>
dplyr::filter(!is.na(n_ais), n_ais > 0) |>
arrange(desc(n_ais)) |>
dplyr::mutate(p_vols = round(100*n_ais_w_vols/n_ais, 1)) |>
dplyr::select(name, n_ais, p_vols) |>
kableExtra::kbl() |>
kableExtra::kable_material(full_width = F) |>
kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) |>
kableExtra::scroll_box(width = "700px")
```
## Shared volumes
```{r}
#| label: tbl-institutional-footprint-vols
#| tbl-cap: "Institutions with the largest number of shared volumes (n_vols). Also shown is the percent of volumes shared by investigators at an institution that are shared publicly."
#| eval: true
#| message: false
#| warning: false
inst_vols <- inst_summ_df[,c(2,5:7)]
inst_vols |>
dplyr::rename(n_vols = tot_n_vols,
n_public = tot_n_public,
n_overview = tot_n_overview) |>
dplyr::filter(!is.na(n_vols), n_vols > 0) |>
arrange(desc(n_vols)) |>
dplyr::mutate(p_public = round(100*n_public/n_vols, 1)) |>
dplyr::select(name, n_vols, p_public) |>
kableExtra::kbl() |>
kableExtra::kable_material(full_width = F) |>
kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) |>
kableExtra::scroll_box(width = "700px")
```
:::
### Histograms
::: {.panel-tabset}
## Authorized Investigators
```{r}
#| label: fig-n-ais-per-institution-histogram
#| fig-cap: "Histogram of the number of Authorized Investigators per institution."
inst_summ_df |>
dplyr::select(n_ais) |>
dplyr::filter(n_ais > 0) |>
ggplot() +
geom_histogram(mapping = aes(n_ais), bins = 15) +
xlab("Authorized Investigators at an institution") +
ylab("Number of institutions") +
theme_classic()
```
## Investigators with volumes
```{r}
#| label: fig-p-ais-per-institution-histogram
#| fig-cap: "Histogram of percent of Investigators at an Institution who have created publicly visible volumes."
inst_invest |>
dplyr::mutate(p_vols = round(100*n_ais_w_vols/n_ais, 1)) |>
dplyr::select(p_vols) |>
ggplot() +
geom_histogram(mapping = aes(p_vols), bins = 15) +
xlab("Percent of Authorized Investigators") +
ylab("Number of institutions") +
theme_classic()
```
## Shared volumes
```{r}
#| label: fig-n-vols-per-institution-histogram
#| fig-cap: "Histogram of the number of shared volumes (datasets) per institution."
institutions_w_vols <- inst_summ_df |>
dplyr::filter(tot_n_vols > 0)
institutions_w_vols |>
dplyr::select(tot_n_vols) |>
ggplot() +
geom_histogram(mapping = aes(tot_n_vols), bins = 15) +
xlab("Total volumes shared by investigators at an institution") +
ylab("Number of institutions") +
theme_classic()
```
```{r}
n_institutions_w_vols <- length(unique(institutions_w_vols$id))
p_institutions_shared_vols <- n_institutions_w_vols/n_institutions
```
N=`{r} n_institutions_w_vols` institutions have Authorized Investigators who have shared volumes. This is `{r} round(100*p_institutions_shared_vols, 2)`% of the total number of institutions.
:::
## Clean up
Logout from Databrary.
```{r}
#| label: clean-up-logout
x <- logout_db()
```