Free Access Week-  Data Engineering + BI
Data engineering and BI courses are free!
Free AI Access Week from June 2-8

pubmedtk (version 1.0.4)

get_pmids_from_searches: Downloads PMID results for a column of Pubmed search queries in a data frame

Description

Downloads PMID results for a column of Pubmed search queries in a data frame

Usage

get_pmids_from_searches(df, column, api_key, quiet = FALSE)

Value

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.

Arguments

df

A dataframe containing a column of Pubmed search queries. This data frame cannot have columns with the following names: pubmed_search_success, pmids.

column

The name of the column containing Pubmed search queries

api_key

A valid Pubmed API key

quiet

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.

Examples

Run this code

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