Write a selection (subset of master) to selection/<name>.csv / .json.
writeSelection.RdDeduplicates (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.
Arguments
- DT
subset of the master
data.table(output ofbuildMaster()after the user's filters).- name
identifier for the selection, used as filename stem.
- path
Absolute path to the directory where
<name>.csvand<name>.jsonwill 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.
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)
#> [1] "demo.csv" "demo.json"