This function retrieves different types of data (like 'PubMed' records, affiliations, 'iCites 'data, etc.) from 'PubMed' based on provided PMIDs. It supports parallel processing for efficiency.

get_records(
  pmids,
  endpoint = c("pubtations", "icites", "pubmed_affiliations", "pubmed_abstracts",
    "pmc_fulltext"),
  cores = 3,
  sleep = 1,
  ncbi_key = NULL
)

Arguments

pmids

A vector of PMIDs for which data is to be retrieved.

endpoint

A character vector specifying the type of data to retrieve ('pubtations', 'icites', 'affiliations', 'pubmed', 'pmc').

cores

Number of cores to use for parallel processing (default is 3).

sleep

Duration (in seconds) to pause after each batch

ncbi_key

(Optional) NCBI API key for authenticated access.

Value

A data.table containing combined results from the specified endpoint.

Examples

pmids <- c("38136652")
results <- get_records(pmids, endpoint = "pubmed_abstracts", cores = 1)
#> Error : HTTP failure: 400
#> <?xml version="1.0" encoding="UTF-8" ?>
#> <!DOCTYPE eEfetchResult PUBLIC "-//NLM//DTD efetch 20131226//EN" "https://eutils.ncbi.nlm.nih.gov/eutils/dtd/20131226/efetch.dtd">
#> <eFetchResult>
#> 	<ERROR> Error: External viewer error: Empty Response. Bytes read: 0 Status: Timeout</ERROR>
#> </eFetchResult>
#> 
#> Error : HTTP failure: 400
#> <?xml version="1.0" encoding="UTF-8" ?>
#> <!DOCTYPE eEfetchResult PUBLIC "-//NLM//DTD efetch 20131226//EN" "https://eutils.ncbi.nlm.nih.gov/eutils/dtd/20131226/efetch.dtd">
#> <eFetchResult>
#> 	<ERROR> Error: External viewer error: Empty Response. Bytes read: 0 Status: Timeout</ERROR>
#> </eFetchResult>
#> 
#> Error : HTTP failure: 400
#> <?xml version="1.0" encoding="UTF-8" ?>
#> <!DOCTYPE eEfetchResult PUBLIC "-//NLM//DTD efetch 20131226//EN" "https://eutils.ncbi.nlm.nih.gov/eutils/dtd/20131226/efetch.dtd">
#> <eFetchResult>
#> 	<ERROR> Error: External viewer error: Empty Response. Bytes read: 0 Status: Timeout</ERROR>
#> </eFetchResult>
#>