Skip to contents

Store a provenance record (from record_provenance()) on an object as an attribute, so the result travels together with its lineage. Retrieve it later with get_provenance().

Usage

attach_provenance(x, provenance)

Arguments

x

Any R object, typically a result tibble.

provenance

Provenance tibble from record_provenance().

Value

x, unchanged except for an added whep_provenance attribute.

Examples

prov <- record_provenance(
  aliases = "bilateral_trade",
  recorded_at = as.POSIXct("2026-01-01", tz = "UTC")
)
result <- attach_provenance(tibble::tibble(value = 1), prov)
get_provenance(result)
#> # A tibble: 1 × 5
#>   recorded_at         whep_version r_version input_alias     input_version      
#>   <dttm>              <chr>        <chr>     <chr>           <chr>              
#> 1 2026-01-01 00:00:00 0.3.0.9000   4.6.1     bilateral_trade 20250714T123347Z-2…