
Prepend a line with a TSSID to a source
Source:R/prepend_tssid_to_source.R
prepend_tssid_to_source.Rd
This function adds a line with a TSSID (a time-stamped source identifier)
to the beginning of a source that was read with one of
the loading_sources
functions. When combined with UIDs, TSSIDs are
virtually unique references to a specific data fragment.
Arguments
- input
The source, as produced by one of the
loading_sources
functions, or a path to an existing file that is then imported.- moment
Optionally, the moment as a character value of the form
2025-05-28 11:30 CEST
(so,YYYY-MM-DD HH-MM
).- output
If specified, the coded source will be written here.
- designationSymbol
The symbol to use to designate an instance identifier for a class (can be "
=
" or ":
" as per the ROCK standard).- preventOverwriting
Whether to prevent overwriting existing files.
- rlWarn
Whether to let
readLines()
warn, e.g. if files do not end with a newline character.- encoding
The encoding to use.
- silent
Whether to be chatty or quiet.
Details
TSSIDs are a date and time in the UTC timezone, consisting of eight digits
(four for the year, two for the month, and two for the day), a T
, four
digits (two for the hour and two for the minute), and a Z
(to designate
that the time is specified in the UTC timezone). TSSIDs are valid ISO8601
standard date/times.
Examples
### Get path to example source
examplePath <-
system.file("extdata", package="rock");
### Get a path to one example file
exampleFile <-
file.path(examplePath, "example-1.rock");
### Parse single example source
loadedExample <-
rock::load_source(exampleFile);
### Add a coder identifier
loadedExample <-
rock::prepend_tssid_to_source(
loadedExample,
moment = "2025-05-28 11:30 CEST"
);
### Show the first line
cat(loadedExample[1]);
#> [[tssid=20250528T0930Z]]