Skip to content

Commit

Permalink
add pubmed trend function
Browse files Browse the repository at this point in the history
  • Loading branch information
reedliu committed Jun 9, 2022
1 parent 09c483e commit 95861ae
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion R/getPubmed.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,27 @@ getPubmed <- function(term,add_term=NULL,num=100){



#---BELOW DEGRADED! ---#
#--- sub function for plotting ---#
getPubmedTrend <- function(term,add_term=NULL,period){
if (!requireNamespace("europepmc", quietly = TRUE)) {
utils::install.packages("europepmc")
}
if(!is.null(add_term)){
supp = paste0('AND ABSTRACT:',add_term) %>% paste(collapse = ' ')
}else{
supp = NULL
}

res = lapply(term , function(i){
europepmc::epmc_hits_trend(paste0('ABSTRACT:',i," ",supp), period = period, synonym = FALSE)
})
names(res) = term

return(res)
}


#--- DEPRECATED---#
# genPubmed <- function(id,
# keywords,
# field = "ALL") {
Expand Down

0 comments on commit 95861ae

Please sign in to comment.