writeSelection: Write a selection table to selection/<name>.csv / '.json'.

View source: R/writeSelection.R

writeSelectionR Documentation

Write a selection table to ⁠selection/<name>.csv⁠ / .json.

Description

Deduplicates ⁠(OwnerID, EventID, StationID)⁠ so the CSV carries one row per station folder (= one record). The JSON sidecar captures audit metadata: name, timestamp, total hits, hits per owner.

Usage

writeSelection(DT, name, path)

Arguments

DT

record metadata data.table after user filters.

name

identifier for the selection, used as filename stem.

path

Absolute path to the directory where ⁠<name>.csv⁠ and ⁠<name>.json⁠ will be written. Required – no default.

Details

The CSV is the canonical input contract for any downstream orchestrator that iterates over a selection: each row identifies one ⁠(OwnerID, EventID, StationID)⁠ station folder under whichever records root the orchestrator was given.

Value

Invisibly, the deduplicated selection data.table.

Examples

x <- data.table::data.table(
  OwnerID = c("AAA", "AAA"),
  EventID = c("E1", "E1"),
  StationID = c("S1", "S1"),
  DIR = c("H1", "H2")
)
path <- file.path(tempdir(), "gmsp-selection-example")
unlink(path, recursive = TRUE)
suppressMessages(writeSelection(x, name = "demo", path = path))
list.files(path)


gmsp documentation built on July 18, 2026, 5:07 p.m.