% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pmExtractReferences.R
\name{pmExtractReferences}
\alias{pmExtractReferences}
\title{Extract references from PubMed XML records}
\usage{
pmExtractReferences(P)
}
\arguments{
\item{P}{A list following the PubMed XML structure produced by
\code{pmApiRequest()} or \code{pmFetchById()}. Must contain a \code{$data}
element with one entry per record.}
}
\value{
A data.frame with columns
\tabular{lll}{
source_pmid \tab \tab The PMID of the article that cites the reference.\cr
citation    \tab \tab The free-text \code{<Citation>} string from PubMed.\cr
pmid        \tab \tab The PMID of the cited reference (if available).\cr
doi         \tab \tab The DOI of the cited reference (if available).}

Returns an empty data.frame (with the same schema) if no references are
found.
}
\description{
Walks a result returned by \code{\link{pmApiRequest}} or
\code{\link{pmFetchById}} and pulls the \code{<ReferenceList>} block out of
every record. Returns one row per cited \code{<Reference>}, carrying the
source PMID, the free-text citation, and (when present) the cited PMID and
DOI parsed from \code{<ArticleIdList>}.
}
\details{
Reference data in PubMed XML is populated when the publisher submits a
\code{<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 \code{\link{pmEnrichCitations}} to also resolve cited
PMIDs into structured WoS-style citation strings.
}
\examples{
\donttest{
D <- pmFetchById("37289732")
refs <- pmExtractReferences(D)
head(refs)
}

}
\seealso{
\code{\link{pmEnrichCitations}}, \code{\link{pmFetchById}}
}
