This function generates utterance identifiers. Utterance identifiers are
Short Quasi-Unique Identifiers (SQUIDs) generated using
the squids::squids() function.
Usage
generate_uids(x, origin = Sys.time(), follow = NULL, followBy = NULL)Arguments
- x
The number of identifiers to generate.
- origin
The origin to use when generating the actual identifiers; see the
squids::squids()documentation.- follow
A vector of one or more UIDs (or a list; lists are recursively
unlist()ed); the highest UID will be taken, converted to a timestamp, and used asorigin(well, 0.01 second later), so that the new UIDs will follow that sequence.- followBy
When following a vector of UIDs, this can be used to specify the distance between the two vectors in centiseconds.
Examples
### Produce and store five UIDs
fiveUIDs <-
rock::generate_uids(5);
### Look at them
fiveUIDs;
#> [1] "[[uid=81pqp5sm]]" "[[uid=81pqp5sn]]" "[[uid=81pqp5sp]]" "[[uid=81pqp5sq]]"
#> [5] "[[uid=81pqp5sr]]"
### Use a specific origin to be able to reproduce
### a set of UIDs later (e.g. in a script)
uidOrigin <-
as.POSIXct("2025-05-21 21:53:25 CEST");
rock::generate_uids(
5,
origin = uidOrigin
);
#> [1] "[[uid=7zqst63b]]" "[[uid=7zqst63c]]" "[[uid=7zqst63d]]" "[[uid=7zqst63f]]"
#> [5] "[[uid=7zqst63g]]"
### Produce five more UIDs to show
### their 'progression'
rock::generate_uids(5);
#> [1] "[[uid=81pqp5sn]]" "[[uid=81pqp5sp]]" "[[uid=81pqp5sq]]" "[[uid=81pqp5sr]]"
#> [5] "[[uid=81pqp5ss]]"
### Produce a set of five UIDs that follow
### the first set of five UIDs
rock::generate_uids(
5,
follow = fiveUIDs
);
#> [1] "[[uid=81pqp5ss]]" "[[uid=81pqp5st]]" "[[uid=81pqp5sw]]" "[[uid=81pqp5sx]]"
#> [5] "[[uid=81pqp5sy]]"
### Follow with a 'distance' of 5 utterances
rock::generate_uids(
5,
follow = fiveUIDs,
followBy = 5
);
#> [1] "[[uid=81pqp5sz]]" "[[uid=81pqp5t0]]" "[[uid=81pqp5t1]]" "[[uid=81pqp5t2]]"
#> [5] "[[uid=81pqp5t3]]"
