Skip to contents

This function searches various NCBI databases using the E-utilities API via the rentrez package.

Usage

ncbi_search(
  query,
  database = "pubmed",
  max_results = 1000,
  use_mesh = FALSE,
  date_range = NULL,
  api_key = NULL,
  retry_count = 3,
  retry_delay = 2
)

Arguments

query

Character string containing the search query.

database

Character string. The NCBI database to search (e.g., "pubmed", "pmc", "gene", "protein").

max_results

Maximum number of results to return.

use_mesh

Logical. If TRUE, will attempt to map query terms to MeSH terms (for PubMed only).

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).

retry_count

Integer. Number of times to retry failed requests.

retry_delay

Integer. Delay between retries in seconds.

Value

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

Examples

if (FALSE) { # \dontrun{
results <- ncbi_search("migraine headache", database = "pubmed", max_results = 100)
gene_results <- ncbi_search("BRCA1", database = "gene", max_results = 10)
} # }