It downloads metadata for a set of PubMed articles identified by their PMID (PubMed Identifier). This is useful for retrieving specific known articles, updating existing datasets, or downloading records identified through other sources.
Arguments
- pmids
is a character or numeric vector. A vector of PubMed identifiers (PMIDs).
- api_key
is a character. It contains a valid API key for the NCBI E-utilities. Default is
api_key=NULL. The API key can also be set via the environment variablePUBMED_API_KEYorENTREZ_KEY.- batch_size
is numeric. The number of records to download per API request. Default is 200.
Value
a list following the same structure as pmApiRequest output, containing:
| data | The xml-structured list containing the bibliographic metadata. | |
| query | A character string describing the PMID-based query. | |
| query_translation | Same as query for PMID-based searches. | |
| records_downloaded | The total number of records downloaded. | |
| total_count | The total number of PMIDs requested. |
Details
The function uses the NCBI E-utilities efetch endpoint to retrieve records directly
by their PMIDs, without requiring a search query. Records are downloaded in batches
to respect API rate limits.
The output is compatible with pmApi2df for conversion to a dataframe.