Skip to contents

Walks a result returned by pmApiRequest or pmFetchById and pulls the <ReferenceList> block out of every record. Returns one row per cited <Reference>, carrying the source PMID, the free-text citation, and (when present) the cited PMID and DOI parsed from <ArticleIdList>.

Usage

pmExtractReferences(P)

Arguments

P

A list following the PubMed XML structure produced by pmApiRequest() or pmFetchById(). Must contain a $data element with one entry per record.

Value

A data.frame with columns

source_pmidThe PMID of the article that cites the reference.
citationThe free-text <Citation> string from PubMed.
pmidThe PMID of the cited reference (if available).
doiThe DOI of the cited reference (if available).

Returns an empty data.frame (with the same schema) if no references are found.

Details

Reference data in PubMed XML is populated when the publisher submits a <ReferenceList> block to NLM (which is now common, but not universal). This function does not call any web API; it merely parses what is already present in the XML. Use pmEnrichCitations to also resolve cited PMIDs into structured WoS-style citation strings.

Examples

if (FALSE) { # interactive()
D <- pmFetchById("37289732")
refs <- pmExtractReferences(D)
head(refs)
}