prepend_tssid_to_source {rock} | R Documentation |
Prepend a line with a TSSID to a source
Description
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.
Usage
prepend_tssid_to_source(
input,
moment = format(Sys.time(), "%Y-%m-%d %H:%M"),
output = NULL,
designationSymbol = "=",
preventOverwriting = rock::opts$get("preventOverwriting"),
rlWarn = rock::opts$get(rlWarn),
encoding = rock::opts$get("encoding"),
silent = rock::opts$get("silent")
)
Arguments
input |
The source, as produced by one of the |
moment |
Optionally, the moment as a character value of the form
|
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 " |
preventOverwriting |
Whether to prevent overwriting existing files. |
rlWarn |
Whether to let |
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.
Value
Invisibly, the coded source object.
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]);