Closed aterhorst closed 2 years ago
PRs are welcome, thanks!
On Wed, Dec 8, 2021 at 6:09 PM Andrew Terhorst @.***> wrote:
The bibtext_core_data function appears to leave out comma after doi entry.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/muschellij2/rscopus/issues/44, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIGPLS3NWD3YE5AXAV755LUP7QTXANCNFSM5JU7U3DA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- Best, John
# load libraries
require(tidyverse)
require(bib2df)
require(rscopus)
# import bibtext file used in thesis
phd_bib <- bib2df::bib2df("clean_bib.bib") %>%
select(title = TITLE, key = BIBTEXKEY, author_list = AUTHOR) %>%
rownames_to_column(var = "entry_no")
# scopus query
set_api_key(Sys.getenv("ELSEVIER_KEY"))
have_api_key()
# create empty bibtex file
fn <- "fixed_bib.bib"
cat("", file = fn)
# loop through raw bibtex file
for(i in 1:nrow(phd_bib)){
skip_to_next <- FALSE
tryCatch({
message('\r', i, '/', nrow(phd_bib), appendLF = FALSE)
# define search string
search_string <- paste("TITLE (\"", phd_bib$title[i],"\")")
# execute search
search <- scopus_search(
verbose = F,
query = search_string,
view = "COMPLETE",
count = 1,
max_count = 1,
wait_time = 0.5,
http = "https://api.elsevier.com/content/search/scopus")
# extract scopus_id
result <- gen_entries_to_df(search[["entries"]])$df %>%
select(scopus_id = `dc:identifier`) %>%
mutate(scopus_id = str_remove(scopus_id, "SCOPUS_ID:"))
# pull bibtex entry
entry <- abstract_retrieval(result$scopus_id, identifier = "scopus", verbose = F)
bib <- bibtex_core_data(entry)
# append to bibtex file
cat(bib, file = fn, append = T)
cat("\n", file =fn, append = T)}, error = function(e) { skip_to_next <<- TRUE })
if(skip_to_next) { next }
}
Got it. I’ll happily review a pull request for the fix
On Wed, Dec 8, 2021 at 6:56 PM Andrew Terhorst @.***> wrote:
clean_bib.bib.zip https://github.com/muschellij2/rscopus/files/7681192/clean_bib.bib.zip
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/muschellij2/rscopus/issues/44#issuecomment-989322676, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIGPLSQ6NZH57QYSMEUK5DUP7WB7ANCNFSM5JU7U3DA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- Best, John
My work around is to add a comma before "abstract =" using find and replace.
As there is no reproducible example, closing.
Hi. I picked up an issue. The bibtext_core_data function appears to leave out comma after doi field. I create an entry using the scopus_id as my object identifier in abstract_retrieval.