Write a data frame to a stable CSV with embedded provenance
Source:R/09-stabilize-data.R
write_stable_csv.RdWrites a CSV that carries its own metadata embedded across the data rows (no sidecar): named `payloads`, and - when a `dgf` is supplied - the DGF's portable contract plus a provenance record. See [read_stable_csv()] to recover them and [dgf_from_stable()] to rebuild the DGF.
Arguments
- df
Data frame to write (typically the output of [stabilize_data()]).
- path
Output file path.
- payloads
Named list of extra R objects to embed. Defaults to none.
- dgf
Optional DGF to embed. Its portable families (`dd_`/`raw_`/ `stable_`/`validate_`/`prov_`) are stored; `rg_*` is excluded, since those are R-native artifacts meaningless to another program. A `provenance` payload is derived automatically.
- start_hash
Optional named list of the parent file's per-column `current_hash`, to chain lineage. When omitted, `dgf`'s `prov_start_hash` column is used if present.
- replication
Optional per-payload replication factors (default 2x).
- chunk_limit
Max characters per embedded chunk.