Learn R Programming

searchAnalyzeR (version 0.1.0)

search_pubmed: Search PubMed and Retrieve Articles

Description

Searches PubMed using the provided search terms and retrieves article metadata in a format compatible with searchAnalyzeR analysis functions.

Usage

search_pubmed(
  search_terms,
  max_results = 200,
  date_range = NULL,
  language = "English"
)

Value

Data frame containing standardized search results

Arguments

search_terms

Character vector of search terms to use in PubMed query

max_results

Maximum number of results to retrieve (default: 200)

date_range

Optional date range as c("YYYY-MM-DD", "YYYY-MM-DD")

language

Optional language filter (default: "English")

Details

This function connects to PubMed using the rentrez package (if available) or provides simulated data if the package is not installed. Results are returned as a standardized data frame ready for use with SearchAnalyzer.

Examples

Run this code
# \donttest{
# Search for diabetes clinical trials
results <- search_pubmed(
  search_terms = c("diabetes", "clinical trial"),
  max_results = 100,
  date_range = c("2020-01-01", "2023-12-31")
)

# Use with SearchAnalyzer
analyzer <- SearchAnalyzer$new(results)
metrics <- analyzer$calculate_metrics()
# }

Run the code above in your browser using DataLab