I learned a bit more about web_history earlier tonight, and I learned how to use it in #163. As I was thinking about the argument, I think it would be more helpful if instead of use_history, the argument was web_history, and it would take a web_history object (or something containing a web_history) and use that instead of creating a new web_history.
What works now is:
library(rentrez)
query_part1 <- "(adolescent[Title/Abstract] OR adolescents[Title/Abstract] OR apprentice[Title/Abstract] OR apprentices[Title/Abstract] OR child[Title/Abstract] OR children[Title/Abstract] OR pupil[Title/Abstract] OR pupils[Title/Abstract] OR student[Title/Abstract] OR students[Title/Abstract] OR teenager[Title/Abstract] OR teenagers[Title/Abstract] OR trainee[Title/Abstract] OR trainees[Title/Abstract] OR young adult[Title/Abstract] OR young adults[Title/Abstract] OR young people[Title/Abstract] OR young worker[Title/Abstract] OR young workers[Title/Abstract] OR younger population[Title/Abstract] OR youth[Title/Abstract])"
query_part3 <- "(frequency[Title/Abstract] OR frequencys[Title/Abstract] OR occurence[Title/Abstract] OR prevalence[Title/Abstract] OR prevalences[Title/Abstract] OR rate[Title/Abstract] OR rates[Title/Abstract] OR risk[Title/Abstract] OR risks[Title/Abstract])"
q1 <- entrez_search(db="pubmed", term=query_part1, use_history=TRUE)
q3 <- entrez_search(db="pubmed", term=query_part3, use_history=TRUE, WebEnv=q1$web_history$WebEnv)
query_combine_1_3 <- sprintf("#%s AND #%s", q1$web_history$QueryKey, q3$web_history$QueryKey)
q1_3 <- entrez_search(db="pubmed", term=query_combine_1_3, use_history=TRUE, WebEnv=q1$web_history$WebEnv)
What I'm hoping could work with this feature request is replaces the last 4 lines with:
q1: use_history has been replaced with web_history
q2: with web_history, it would automatically extract the web_history object from q1, and it would automatically add the WebEnv request variable.
This would also suggest that an as_web_history() generic function that would extract the web_history from any object containing a web_history object would be helpful to make this work more smoothly.
I learned a bit more about web_history earlier tonight, and I learned how to use it in #163. As I was thinking about the argument, I think it would be more helpful if instead of
use_history
, the argument wasweb_history
, and it would take aweb_history
object (or something containing aweb_history
) and use that instead of creating a newweb_history
.What works now is:
What I'm hoping could work with this feature request is replaces the last 4 lines with:
The differences are:
q1
:use_history
has been replaced withweb_history
q2
: withweb_history
, it would automatically extract the web_history object fromq1
, and it would automatically add theWebEnv
request variable.This would also suggest that an
as_web_history()
generic function that would extract theweb_history
from any object containing a web_history object would be helpful to make this work more smoothly.