Skip to contents

This function searches PubMed using the NCBI E-utilities API via the rentrez package. The implementation includes optimizations for speed, memory efficiency, and reliability.

Usage

pubmed_search(
  query,
  max_results = 1000,
  use_mesh = FALSE,
  date_range = NULL,
  api_key = NULL,
  batch_size = 200,
  verbose = TRUE,
  use_cache = TRUE,
  retry_count = 3,
  retry_delay = 1
)

Arguments

query

Character string containing the search query.

max_results

Maximum number of results to return.

use_mesh

Logical. If TRUE, will attempt to map query terms to MeSH terms.

date_range

Character vector of length 2 with start and end dates in format "YYYY/MM/DD".

api_key

Character string. NCBI API key for higher rate limits (optional).

batch_size

Integer. Number of records to fetch in each batch (default: 200).

verbose

Logical. If TRUE, prints progress information.

use_cache

Logical. If TRUE, cache results to avoid redundant API calls.

retry_count

Integer. Number of times to retry failed API calls.

retry_delay

Integer. Initial delay between retries in seconds.

Value

A data frame containing the search results with PubMed IDs, titles, and other metadata.

Examples

if (FALSE) { # \dontrun{
results <- pubmed_search("migraine headache", max_results = 100)
} # }