Skip to contents

Scans a data frame for a DOI column, extracts all valid identifiers, and queries the OpenAlex API in batches of up to 50 items to retrieve up-to-date citation metrics (cited_by_count). The results are joined back to the original data frame under a new citations column.

Usage

fetch_citation_counts(df, email_contact = Sys.getenv("POLITE_EMAIL"))

Arguments

df

A data frame containing bibliographic data, typically generated by fetch_all_zotero_data().

email_contact

Character string containing the contact email used to gain entry to the OpenAlex "Polite Pool." Defaults to the system environment variable Sys.getenv("POLITE_EMAIL").

Value

A data frame identical to the input, but with an added integer column named citations containing the citation metrics. Rows with missing or unmatched DOIs will default to NA.

Examples

if (FALSE) { # \dontrun{
enriched_data <- fetch_citation_counts(raw_data)
} # }