Downloads PMID results for a column of Pubmed search queries in a data frame
get_pmids_from_searches(df, column, api_key, quiet = FALSE)
A data frame containing the original columns as well as three additional columns:
The `pubmed_search_success` column is TRUE in the case that the
search rcesults were successfully obtained from Pubmed; FALSE
in the case that an error occurred in search (e.g. due to a
search query that is not well-formed).The `n_results` column contains the number of research results
for the query provided.
The `pmids` column returns a JSON-encoded list of PMID's for
the search query provided.
A dataframe containing a column of Pubmed search
queries. This data frame cannot have columns with the following
names: pubmed_search_success
, pmids
.
The name of the column containing Pubmed search queries
A valid Pubmed API key
A boolean TRUE or FALSE. If TRUE, no progress messages will be printed during download. FALSE by default, messages printed for every version downloaded showing progress.
if (FALSE) {
## Read in API key
ak <- readLines("api_key.txt")
## Example Pubmed searches, some valid, some not, some with more
## than 10k results
searches <- tribble(
~terms,
"Carlisle B[Author]",
"NCT00267865",
"(Clinical Trial[Publication Type])",
""
)
## Download search results
results <- get_pmids_from_searches(searches, "terms", ak)
}
Run the code above in your browser using DataLab