subset_snapshot: Subset observational filesystem Instantiations

View source: R/subset_snapshot.R

subset_snapshotR Documentation

Subset observational filesystem Instantiations

Description

Selects observations from a snapshot according to structural criteria such as paths, extensions, or exclusion patterns.

Usage

subset_snapshot(
  snapshot_path,
  folder_path,
  extensions = NULL,
  exclude_patterns = c("\\.Rcheck")
)

Arguments

snapshot_path

Character. Path to .rds snapshot file.

folder_path

Character vector. One or more folder roots.

extensions

Optional character vector of file extensions (no dot).

exclude_patterns

Optional regex patterns to exclude paths.

Details

The function performs observational selection only and does not derive Record Sets, contextual hierarchies, or analytical groupings.

The function returns a subset of the original snapshot while preserving its observational provenance (e.g. created_by, created_at).

In addition, it derives a rel_root_path column, which represents the path of each file relative to the matched filter root. When multiple folder_path values are provided, the deepest matching root is used.

The rel_root_path is a context-dependent projection intended for grouping, navigation, and reporting. It is not a stable identifier and should not be used for joins or identity; use rel_path for that purpose.

Value

data.frame filtered snapshot with rel_root_path

Examples

data("fscontextdemo_snapshot_02")

tmp <- tempfile(fileext = ".rds")
saveRDS(fscontextdemo_snapshot_02, tmp)

subset_snapshot(
  snapshot_path = tmp,
  folder_path = "D:/_packages/fscontextdemo/R"
)

fscontext documentation built on Nov. 19, 2026, 5:11 p.m.