Skip to content

Commit

Permalink
Final changes to cluster dataset (add timestamp)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrug committed May 8, 2024
1 parent 90314bc commit 5b287a8
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions snowball.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ cluster <- lapply(
fns,
function(fn) {
list(
timestamp = Sys.time(),
fn = fn,
dois = read.csv(fn)$DOI
)
Expand Down Expand Up @@ -193,32 +194,27 @@ if (file.exists(fn)) {
cluster,
function(cl) {
message("Processing ", cl$fn, " ...")
message("|- Fetching works...")
key_works <- oa_fetch(
message("|- Fetching works ...")
cl$key_works <- oa_fetch(
entity = "works",
doi = cl$dois,
verbose = FALSE
)
key_works$id <- gsub(
cl$key_works$id <- gsub(
pattern = "https://openalex.org/",
replacement = "",
key_works$id
cl$key_works$id
)
message("|- Snowballing works...")
snowball <- oa_snowball(
identifier = openalexR:::shorten_oaid(key_works$id),
message("|- Snowballing works ...")
cl$snowball_1 <- oa_snowball(
identifier = openalexR:::shorten_oaid(cl$key_works$id),
verbose = FALSE
)
message("|- Converting to tibble...")
snowball_df <- snowball2df(snowball) |>
message("|- Converting to tibble ...")
cl$snowball_1_df <- snowball2df(cl$snowball_1) |>
as_tibble()
message("\n")
list(
cl,
key_works = key_works,
snowball_1 = snowball,
snowball_1_df = snowball_df
)
return(cl)
}
)
Expand Down

0 comments on commit 5b287a8

Please sign in to comment.