Skip to content

Instantly share code, notes, and snippets.

@cmt2
Created September 19, 2023 00:14
Show Gist options
  • Save cmt2/3502644a1e2b4524f743fd14c3d61d70 to your computer and use it in GitHub Desktop.
Save cmt2/3502644a1e2b4524f743fd14c3d61d70 to your computer and use it in GitHub Desktop.
Reviewer conflicts code
##### Script to check if the authors of a paper have co-authored with
##### a potential reviewer within the past 4 years (following COI for
##### NSF and various journals). I make o guarantees this will work,
##### as name changes, variations in spellings, etc. might interfere
##### with the code. Please note that this does not check for other
##### potential conflicts such as mentorship relationships, etc.
library(lubridate)
library(scholar)
##### make list of recent co-authors for all manuscript authors #####
# Put author google scholar IDs here
# IDs are part of the google scholar URL, after "user=" and before the "&"
ids <- c()
authors <- list()
for (i in 1:length(ids)) {
id <- ids[i]
pubs <- get_publications(id)
pubs_recent <- pubs[pubs$year > 2018,]
pub_ids <- na.omit(pubs_recent$pubid)
authors[[i]] <- vector(mode = "character", length = length(pub_ids))
for (j in 1:length(pub_ids)) {
authors[[i]][j] <- get_publication_data_extended(id = id, pub_id = pub_ids[j])$Authors
}
}
authors <- unlist(authors)
##### Check for conflicts with suggested reviewers #####
# put reviewer names here
last_names <- c()
good <- last_names
for (i in 1:length(last_names)) {
if (identical(grep(last_names[i], authors), integer(0))) {
good[i] <- good[i]
} else { good[i] <- NA }
}
# this will only print out the last names of the reviewers who do not have
# conflicts due to co-authorship
print(good)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment