Code
#|
kp <- jsonlite::read_json(params$keypapers)
dois <- sapply(
kp,
function(x) {
x$DOI
}
) |>
unlist() |>
unique() |>
as.character()
dois <- dois[!is.null(dois)]Data Management Report
A snowball literature using OpenAlex will be conducted and all steps documented. The literature search is for the IPLC section of Chapter 6 of the IPBES Business and Biodiversity assessment.
Literature search for BBA Chapter 6 Finance Section
#|
kp <- jsonlite::read_json(params$keypapers)
dois <- sapply(
kp,
function(x) {
x$DOI
}
) |>
unlist() |>
unique() |>
as.character()
dois <- dois[!is.null(dois)]Of the 20 keypapers, 14 have a DOI and can be used for the further search.
Searches are conducted with the OpenAlex API. The API is documented here.
#|
fn <- file.path("data", "key_works.rds")
if (!file.exists(fn)) {
key_works <- oa_fetch(
entity = "works",
doi = grep("^W.*", dois, invert = TRUE, value = TRUE),
verbose = FALSE
) |>
tibble::add_row(
oa_fetch(
entity = "works",
grep("^W.*", dois, value = TRUE),
verbose = FALSE
)
)
saveRDS(key_works, fn)
} else {
key_works <- readRDS(fn)
}
key_works_cit <- IPBES.R::abbreviate_authors(key_works)#|
ids <- openalexR:::shorten_oaid(key_works$id)
fn <- file.path("data", "snowball.rds")
if (file.exists(fn)) {
snowball <- readRDS(fn)
} else {
snowball <- oa_snowball(
identifier = ids,
verbose = FALSE
)
saveRDS(snowball, fn)
}
flat_snow <- snowball2df(snowball) |>
tibble::as_tibble()#|
fn <- file.path("data", "snowball_supplemented.rds")
if (file.exists(fn)) {
snowball_supplemented <- readRDS(fn)
} else {
new_edges <- tibble(
from = character(0),
to = character(0)
)
works <- snowball$nodes$id
for (i in 1:nrow(snowball$nodes)) {
from <- works[[i]]
to <- gsub("https://openalex.org/", "", snowball$nodes$referenced_works[[i]])
to_in_works <- to[to %in% works]
if (length(to_in_works) > 0) {
new_edges <- add_row(
new_edges,
tibble(
from = from,
to = to_in_works
)
)
}
}
snowball_supplemented <- snowball
snowball_supplemented$edges <- add_row(snowball_supplemented$edges, new_edges) |>
distinct()
saveRDS(snowball_supplemented, fn)
}snowball$edges |>
filter(from %in% names(key_works_cit)) |>
unique() |>
mutate(
cit = unlist(key_works_cit[from])
) |>
select(cit) |>
table() |>
as.data.frame() |>
arrange(desc(Freq)) |>
knitr::kable(
col.names = c("Key paper", "Number of papers"),
caption = "Number of papers cited by Keypapers in the snowball search"
)| Key paper | Number of papers |
|---|---|
| Coria & Calfucura (2012) | 73 |
| Horowitz et al. (2018) | 57 |
| Jones et al. (2019) | 35 |
| Zeppel (2010) | 32 |
| Watson et al. (2011) | 28 |
| Gadgil et al. (1993) | 24 |
| Gunn (2001) | 17 |
| Clarke (1990) | 13 |
| Ekpe (2012) | 13 |
| Bohensky & Maru (2011) | 11 |
| Smith et al. (2019) | 11 |
snowball$edges |>
filter(to %in% names(key_works_cit)) |>
unique() |>
mutate(
cit = unlist(key_works_cit[to]),
) |>
select(cit) |>
table() |>
as.data.frame() |>
arrange(desc(Freq)) |>
knitr::kable(
col.names = c("Key paper", "Number of papers"),
caption = "No of papers citing the Keypapers in the snowball search"
)| Key paper | Number of papers |
|---|---|
| Gadgil et al. (1993) | 319 |
| Dawson et al. (2021) | 318 |
| Bohensky & Maru (2011) | 283 |
| Coria & Calfucura (2012) | 280 |
| Horowitz et al. (2018) | 54 |
| Smith et al. (2019) | 36 |
| Gunn (2001) | 32 |
| Zeppel (2010) | 29 |
| Jones et al. (2019) | 24 |
| Watson et al. (2011) | 20 |
| Clarke (1990) | 10 |
| Ekpe (2012) | 2 |
#|
fn <- file.path(".", "data", "snowball_excel.xlsx")
if (!file.exists(fn)) {
IPBES.R::to_xlsx(snowball, fn)
}To download the Excsl file with all references, plese click here.
The column are: (the Concept columns are not that relevant at the moment)
#|
name <- "snowball"
if (
any(
!file.exists(
c(
file.path("figures", paste0(name, "_cited_by_count.png")),
file.path("figures", paste0(name, "_cited_by_count.pdf")),
file.path("figures", paste0(name, "_cited_by_count_by_year.png")),
file.path("figures", paste0(name, "_cited_by_count_by_year.pdf"))
)
)
)
) {
snowball_p <- snowball
for (i in seq_along(key_works_cit)) {
snowball_p$nodes$id[snowball_p$nodes$id %in% key_works_cit[[i]]["id"]] <- key_works_cit[[i]]["cit"]
snowball_p$edges$from[snowball_p$edges$from %in% key_works_cit[[i]]["id"]] <- key_works_cit[[i]]["cit"]
snowball_p$edges$to[snowball_p$edges$to %in% key_works_cit[[i]]["id"]] <- key_works_cit[[i]]["cit"]
}
IPBES.R::plot_snowball(snowball_p, name = name, path = "figures")
rm(snowball_p)
}To download the highres graph, please click here.
name <- "snowball_supplemented"
if (
any(
!file.exists(
c(
file.path("figures", paste0(name, "_cited_by_count.png")),
file.path("figures", paste0(name, "_cited_by_count.pdf")),
file.path("figures", paste0(name, "_cited_by_count_by_year.png")),
file.path("figures", paste0(name, "_cited_by_count_by_year.pdf"))
)
)
)
) {
snowball_supplemented$nodes$cited_by_count_by_year <- snowball_supplemented$nodes$cited_by_count / (2024 - snowball_supplemented$nodes$publication_year)
snowball_p <- snowball_supplemented
for (i in seq_along(key_works_cit)) {
snowball_p$nodes$id[snowball_p$nodes$id %in% key_works_cit[[i]]["id"]] <- key_works_cit[[i]]["cit"]
snowball_p$edges$from[snowball_p$edges$from %in% key_works_cit[[i]]["id"]] <- key_works_cit[[i]]["cit"]
snowball_p$edges$to[snowball_p$edges$to %in% key_works_cit[[i]]["id"]] <- key_works_cit[[i]]["cit"]
}
IPBES.R::plot_snowball(snowball_p, name = name, path = "figures")
rm(snowball_p)
}