cite_capsule: Generate a Data Citation From Provenance

View source: R/lib_capsule.R

cite_capsuleR Documentation

Generate a Data Citation From Provenance

Description

Builds a ready-to-paste data citation (plain text and BibTeX ⁠@misc⁠) from a provenance object's dataset and resource blocks, using publisher, resource name, source system, retrieval date, license, the pinned URL, and a DOI when one is recorded (dataset$doi).

Usage

cite_capsule(provenance)

Arguments

provenance

A provenance list as returned by load_provenance().

Value

A list with text and bibtex character scalars, or NULL if provenance is NULL.

Examples

prov <- list(
  captured_at_utc = "2026-06-23T04:41:40Z",
  dataset = list(publisher = "Ontario Ministry of the Solicitor General",
                 licence_short = "OGL-Ontario",
                 package_slug = "data-on-inmates-in-ontario"),
  resource = list(name = "Restrictive Confinement - Detailed Dataset",
                  direct_url = "https://data.ontario.ca/example.csv")
)
cit <- cite_capsule(prov)

# Plain-text citation ready to paste.
cat(cit$text)

# BibTeX @misc entry for LaTeX bibliographies.
cat(cit$bibtex)

# NULL provenance returns NULL (composes safely).
cite_capsule(NULL)

rmoriebricklayer documentation built on Aug. 5, 2026, 9:08 a.m.