Find unique labels for entities, or create them if not present.

sc_uid(x, ..., uid_nchar = NULL)

Arguments

x

number of unique IDs to generate

...

reserved for future use

uid_nchar

number of raw characters to paste as a uuid, default is 6 (only if silicate.uid.type is "uuid", see Details)

Value

vector of unique id values for elements in the input

Details

If 'integers' default we generate sequential integers, it's assumed that all IDs are created at one time, we are not adding to an existing set. Code that adds IDs should find the largest existing ID and offset these by that value.

Using 'silicate.uid.type="uuid"' is the default. Using 'silicate.uid.type="integer"' is considered experimental. By default UIDs are a mix of letters, LETTERS and digits of length getOption("silicate.uid.size") which defaults to 6.

See ids package for random_id used if option 'silicate.uid.type="uuid"'.

Examples

sc_uid(data.frame(1:10))
#>  [1] "HIOczg" "ySbeKD" "10cTw8" "odbclw" "c0HtpE" "xMmZh5" "I4FjL5" "QxjNCp"
#>  [9] "LHYvev" "1LtCTH"