Searches PubMed using the provided search terms and retrieves article metadata in a format compatible with searchAnalyzeR analysis functions.
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
# \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")
)
#> PubMed Query: ( "diabetes"[Title/Abstract] OR "clinical trial"[Title/Abstract] ) AND ("2020/01/01"[Date - Publication] : "2023/12/31"[Date - Publication]) AND English [Language]
#> Found 100 articles
#> Retrieving batch 1 of 2
#> Retrieving batch 2 of 2
# Use with SearchAnalyzer
analyzer <- SearchAnalyzer$new(results)
metrics <- analyzer$calculate_metrics()
#> Warning: No gold standard provided - cannot calculate precision/recall
# }