Skip to contents

Look up DOIs in the corpus via the Altmetric API and add attention scores, Mendeley reader counts, and social media metrics to the works table.

This enricher is idempotent: re-running it updates existing Altmetric data rather than duplicating it.

Usage

sm_enrich_altmetric(
  corpus,
  api_key = Sys.getenv("ALTMETRIC_API_KEY"),
  verbose = TRUE,
  call = rlang::caller_env()
)

Arguments

corpus

An sm_corpus object.

api_key

Altmetric API key. Read from ALTMETRIC_API_KEY env var. The free tier (no key) is used when empty.

verbose

Print progress messages?

call

Caller environment for error reporting.

Value

An sm_corpus object with added altmetric_score, mendeley_readers, twitter_count, and news_count columns in the works table, plus new provenance rows.

Examples

if (FALSE) { # \dontrun{
corpus <- sm_example_corpus()
corpus <- sm_enrich_altmetric(corpus)
} # }