Lightweight versioned artifact store for R with sidecar metadata and pruning policies.
After the first CRAN release, install stamp with:
install.packages("stamp")You can install the development version of stamp from GitHub with:
# install.packages("devtools")
devtools::install_github("randrescastaneda/stamp")library(stamp)
root <- tempfile("stamp-readme-")
st_init(root)
#> ✔ stamp initialized
#> alias: default
#> root:
#> /var/folders/y8/8yc4jpc167gf18tx3w3b858m0000gp/T/RtmpwTgfXN/stamp-readme-9754793f762a
#> state:
#> /var/folders/y8/8yc4jpc167gf18tx3w3b858m0000gp/T/RtmpwTgfXN/stamp-readme-9754793f762a/.stamp
p <- "demo.qs2"
x <- data.frame(id = 1:3, val = letters[1:3])
# Save with primary key (code parameter tracks provenance - see vignettes)
st_save(x, p, pk = "id")
#> ✔ Saved [qs2] →
#> '/var/folders/y8/8yc4jpc167gf18tx3w3b858m0000gp/T/RtmpwTgfXN/stamp-readme-9754793f762a/demo.qs2'
#> @ version 2b45dd07357b8f27
y <- st_load(p)
#> ✔ Loaded [qs2] ←
#> '/var/folders/y8/8yc4jpc167gf18tx3w3b858m0000gp/T/RtmpwTgfXN/stamp-readme-9754793f762a/demo.qs2'
vrs <- st_versions(p)
head(vrs)
#> version_id artifact_id content_hash code_hash size_bytes
#> <char> <char> <char> <char> <num>
#> 1: 2b45dd07357b8f27 116d73b1d46ede57 af870b362628c1e0 <NA> 297
#> created_at sidecar_format
#> <char> <char>
#> 1: 2026-10-26T21:47:16.455698Z json
# Retention
st_opts(retain_versions = 2)
#> ✔ stamp options updated
#> retain_versions = "2"
st_save(transform(x, val = toupper(val)), p)
#> ✔ Retention policy matched zero versions; nothing to prune.
#> ✔ Saved [qs2] →
#> '/var/folders/y8/8yc4jpc167gf18tx3w3b858m0000gp/T/RtmpwTgfXN/stamp-readme-9754793f762a/demo.qs2'
#> @ version 89a99c12e281212c
vrs <- st_versions(p)
head(vrs)
#> version_id artifact_id content_hash code_hash size_bytes
#> <char> <char> <char> <char> <num>
#> 1: 89a99c12e281212c 116d73b1d46ede57 e502c206ef276962 <NA> 265
#> 2: 2b45dd07357b8f27 116d73b1d46ede57 af870b362628c1e0 <NA> 297
#> created_at sidecar_format
#> <char> <char>
#> 1: 2026-10-26T21:47:16.528095Z json
#> 2: 2026-10-26T21:47:16.455698Z jsonSee the vignette “Using Aliases with stamp” for a comprehensive guide:
vignettes/using-alias.Rmdstamp supports multiple serialization formats. The two
binary formats have distinct implementations:
| Extension | Format | Package Required | Notes |
|---|---|---|---|
.qs2 |
qs2 | {qs2} |
Binary format (recommended for new projects) |
.rds |
rds | (base R) | R serialized format |
.csv |
csv | {data.table} |
Comma-separated values |
.fst |
fst | {fst} |
Fast columnar format |
.json |
json | {jsonlite} |
JSON format |
.parquet |
parquet | {nanoparquet} |
Columnar format |
Important: .qs2 requires
{qs2}. If you attempt to save or load a .qs2
file without {qs2} installed, stamp aborts
with a clear error message.
Unrecognized extensions fall back to the
default_formatoption ("qs2") rather than raising an error, so passformat =explicitly whenever the extension is not one of those listed above.
# For qs2 format support
install.packages("qs2")
# For fst format support
install.packages("fst")stamp infers format from file extension by default:
# Uses qs2 format (requires {qs2})
st_save(data, "output.qs2")
# Uses RDS (base R, always available)
st_save(data, "output.rds")You can also specify format explicitly:
st_save(data, "output", format = "qs2")The functions below are organized by workflow. New users should start with Initialization, Save & Load, and Versioning sections. Advanced features like lineage tracking and aliases are covered in the vignettes.
st_init(root) - Initialize stamp in a
directory, creating the .stamp/ state folderst_opts() - Get or set package options
(versioning mode, retention policies, metadata format)st_opts_get(key = NULL) - Read a
single option, or all of them when key is
NULLst_opts_reset() - Reset all options to
defaultsst_save(x, file, ...) - Save an
artifact with automatic versioning, metadata, and lineage tracking
pk (primary key), parents
(lineage), code (provenance), domain
(category), alias (target directory)st_load(file, ...) - Load the current
artifact
alias (source directory). Use
st_opts(verify_on_load = TRUE) for integrity warnings;
there is no verify argument.st_load_version(path, version_id) -
Load a specific historical version by IDAn experimental, disabled-by-default
st_opts(reference_copy_on_save = TRUE) pilot protects only
supported root ordinary-environment graphs in native RDS
st_save() calls by copying once. Ordinary values keep their
existing path. It is not a global hashing policy: direct
st_hash_obj() and comparison APIs remain unchanged.
Classed/R6 environments, active/lazy bindings, special roots, opaque
resources and unsupported graph values are outside the pilot and
rejected when it is enabled. Recognized special parents stay shared,
uninspected boundaries; ordinary parent environments are inspected and
copied. See ?st_save for the accepted values and graph
limits. Do not enable it broadly as generic reference-object
support.
st_formats() - List the registered
format handlers (csv, fst, json,
parquet, qs2, rds)st_register_format(name, read, write, extensions = NULL)
- Register or override a format handler, optionally mapping file
extensions to itst_versions(path) - List all versions
of an artifact with metadata (timestamp, size, hashes)st_latest(path) - Get the version ID
of the most recent versionst_changed(path, x = NULL) - Check if
an object differs from the saved versionst_changed_reason(path, x = NULL) -
Explain why content/code changedst_should_save(path, x = NULL) -
Determine whether saving would create a new versionst_restore(file, version = "oldest", ...)
- Restore a retained snapshot. Use 0 for latest,
-1 for previous, or -n for n
retained versions back. Positive positions are deprecated; the default
remains "oldest".For st_changed(), st_changed_reason() and
st_should_save(), omit x to leave object
content unchecked. Explicit x = NULL compares with a NULL
value. Use RDS or QS2 to save and restore NULL as an R object; it is not
a deletion.
Native RDS/QS2 saves also preserve original data.table keys in per-version sidecars. Unkeyed inputs remain unkeyed; PK declarations do not create keys. Key-only changes can create metadata versions without changing the data hash. Loading never sorts rows to invent or repair a key, and legacy snapshots without descriptors cannot recover keys that were not recorded.
st_lineage(path, depth = 1) - Show
parent artifacts (inputs) for a given artifactst_children(path, depth = 1) - Show
child artifacts (outputs) that depend on this artifactst_is_stale(path) - Check if an
artifact needs rebuilding because parents changedst_catalog_query(alias = NULL) -
Return a data.table with the latest version metadata for
every artifact in a catalog — one row per artifact (path,
version_id, content_hash,
code_hash, size_bytes,
created_at). Useful for downstream consumers that need a
snapshot of all tracked artifacts without iterating over individual
paths.st_info(path) - Get comprehensive
artifact information (sidecar, catalog, snapshot location, parents)st_read_sidecar(path) - Read sidecar
metadata (hashes, timestamps, primary keys, domain, parents)st_hash_obj(x) - Compute stable hash
for any R objectst_add_pk(path, keys) - Add or update
primary key definition for an artifactst_get_pk(x_or_meta) - Retrieve
primary key columns from metadatast_inspect_pk(path) - Inspect recorded
primary-key metadata; this does not scan the payload for uniquenessst_pk(x = NULL, keys, ...) - Normalize
a primary-key specification, optionally validating it against
xst_with_pk(x, keys) - Attach
primary-key metadata to a data.frame in memory, without savingst_prune_versions(path, policy) -
Remove old versions based on retention policyst_alias_list() - List all registered
aliasesst_alias_get(alias = NULL) - Get
configuration for an aliasst_switch(alias) - Switch the
session’s default aliasNote: The builder system is under active development. Safe for prototyping, but consider pinning your stamp version in production code until the API stabilizes (expected in v1.0).
st_register_builder(path, fun, name = NULL)
- Register a function to rebuild an artifact from its parentsst_clear_builders(path = NULL) - Clear
registered buildersst_builders() - List the currently
registered buildersst_plan_rebuild(targets, ...) -
Compute rebuild plan (which targets are stale and why)st_rebuild(plan) - Execute a rebuild
plan, calling builders and saving resultsNote: Advanced filtering utilities are under development.
st_filter(df, filters = list(), strict = TRUE)
- Apply named list filters to data framesFor detailed guides and workflows, see the package vignettes:
.stamp/ internal
structure