% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pmCitedBy.R
\name{pmEnrichCitations}
\alias{pmEnrichCitations}
\title{Enrich a PubMed dataframe with citation data}
\usage{
pmEnrichCitations(df, api_key = NULL)
}
\arguments{
\item{df}{is a dataframe. A bibliometric dataframe produced by \code{\link{pmApi2df}}.}

\item{api_key}{is a character. It contains a valid API key for the NCBI E-utilities.
Default is \code{api_key=NULL}. The API key can also be set via the environment variable
\code{PUBMED_API_KEY} or \code{ENTREZ_KEY}.}
}
\value{
The input dataframe with updated CR (Cited References) and TC (Times Cited) fields.
}
\description{
It adds cited references (CR field) and citation counts (TC field)
to a dataframe created by \code{\link{pmApi2df}}, using NCBI E-Link data.
}
\details{
This function iterates over each record in the dataframe and queries NCBI E-Link
to retrieve: (1) The PMIDs of references cited by each article (populates CR field),
and (2) The count of articles citing each article (populates TC field).

Note: This process makes two API calls per article and can be slow for large datasets.
An API key is strongly recommended.
}
\examples{

\donttest{
query <- "bibliometric*[Title/Abstract] AND english[LA]
         AND Journal Article[PT] AND 2000:2020[DP]"
D <- pmApiRequest(query = query, limit = 10, api_key = NULL)
M <- pmApi2df(D)
M <- pmEnrichCitations(M)
}

}
\seealso{
\code{\link{pmCitedBy}}

\code{\link{pmReferences}}

\code{\link{pmApi2df}}
}
