| Title: | Modern UUIDs for R with a Rust Backend |
|---|---|
| Description: | Generate, parse, and validate RFC 9562 UUIDs from R using the Rust 'uuid' crate via 'extendr'. Developed by Thomas Bryce Kelly at Icy Seas Co-Laboratory LLC. Version 7 UUIDs are the default for new identifiers, while versions 4, 5, 6, and legacy version 1 are also supported. Functions return character vectors by default and can also expose 16-byte raw representations for low-level workflows. |
| Authors: | Thomas Bryce Kelly [aut, cre], Icy Seas Co-Laboratory LLC [cph] |
| Maintainer: | Thomas Bryce Kelly <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.1 |
| Built: | 2026-05-10 09:13:09 UTC |
| Source: | https://github.com/cran/uuidx |
uuid_generate() is the main entry point for new UUID creation. It defaults
to version 7, which is typically a practical default for new identifiers
because it keeps the randomness users expect while sorting naturally by time.
uuid_generate( n = 1L, version = c("v7", "v4", "v5", "v6", "v1"), namespace = NULL, name = NULL, output = c("string", "raw") )uuid_generate( n = 1L, version = c("v7", "v4", "v5", "v6", "v1"), namespace = NULL, name = NULL, output = c("string", "raw") )
n |
Number of UUIDs to generate. Must be a single non-negative integer. |
version |
UUID version to generate. Defaults to |
namespace |
Namespace UUID used for version 5 generation. Standard
aliases |
name |
Name value or values used for version 5 generation. |
output |
Output format. |
Version 5 is name-based and deterministic, so it uses namespace and
name instead of n.
A character vector for output = "string" or a list of raw vectors
for output = "raw".
uuid_generate() uuid_generate(3, version = "v4") uuid_generate(version = "v5", namespace = "dns", name = c("a", "b"))uuid_generate() uuid_generate(3, version = "v4") uuid_generate(version = "v5", namespace = "dns", name = c("a", "b"))
Return the Max UUID
uuid_max(output = c("string", "raw"))uuid_max(output = c("string", "raw"))
output |
Output format. |
A length-one character vector or a raw vector.
uuid_max() uuid_max(output = "raw")uuid_max() uuid_max(output = "raw")
Return the Nil UUID
uuid_nil(output = c("string", "raw"))uuid_nil(output = c("string", "raw"))
output |
Output format. |
A length-one character vector or a raw vector.
uuid_nil() uuid_nil(output = "raw")uuid_nil() uuid_nil(output = "raw")
uuid_parse() canonicalizes UUID strings and can optionally expose their raw
bytes or field-level structure.
uuid_parse(x, output = c("string", "raw", "fields"))uuid_parse(x, output = c("string", "raw", "fields"))
x |
Character vector of UUID strings. |
output |
Output format. |
For output = "fields", the returned data frame exposes structural UUID
fields. These field names follow the conventional UUID layout, although the
semantics of those fields vary by UUID version.
A character vector, a list of raw vectors, or a "uuid_fields"
data frame depending on output.
x = uuid_v7(2) uuid_parse(x) uuid_parse(x, output = "raw") uuid_parse(x, output = "fields")x = uuid_v7(2) uuid_parse(x) uuid_parse(x, output = "raw") uuid_parse(x, output = "fields")
Version 1 remains available for compatibility work, but it is treated as a legacy option in this package.
uuid_v1(n = 1L, output = c("string", "raw"))uuid_v1(n = 1L, output = c("string", "raw"))
n |
Number of UUIDs to generate. Must be a single non-negative integer. |
output |
Output format. |
A character vector or a list of 16-byte raw vectors.
Version 4 UUIDs are fully random identifiers.
uuid_v4(n = 1L, output = c("string", "raw"))uuid_v4(n = 1L, output = c("string", "raw"))
n |
Number of UUIDs to generate. Must be a single non-negative integer. |
output |
Output format. |
A character vector or a list of 16-byte raw vectors.
Version 5 UUIDs are derived from a namespace UUID and a name using SHA-1.
uuid_v5(namespace, name, output = c("string", "raw"))uuid_v5(namespace, name, output = c("string", "raw"))
namespace |
Namespace UUID or one of |
name |
One or more name strings. |
output |
Output format. |
A character vector or a list of 16-byte raw vectors.
uuid_v5("dns", "example.com") uuid_v5("dns", c("alpha", "beta"))uuid_v5("dns", "example.com") uuid_v5("dns", c("alpha", "beta"))
Version 6 UUIDs retain the timestamp-based lineage of version 1 while being more naturally sortable.
uuid_v6(n = 1L, output = c("string", "raw"))uuid_v6(n = 1L, output = c("string", "raw"))
n |
Number of UUIDs to generate. Must be a single non-negative integer. |
output |
Output format. |
A character vector or a list of 16-byte raw vectors.
Version 7 UUIDs are time-ordered and are the default in uuidx.
uuid_v7(n = 1L, output = c("string", "raw"))uuid_v7(n = 1L, output = c("string", "raw"))
n |
Number of UUIDs to generate. Must be a single non-negative integer. |
output |
Output format. |
A character vector or a list of 16-byte raw vectors.
Validate UUID Strings
uuid_validate(x)uuid_validate(x)
x |
Vector to validate. |
A logical vector where valid UUIDs are TRUE.
uuid_validate(c(uuid_v7(), "not-a-uuid"))uuid_validate(c(uuid_v7(), "not-a-uuid"))
Detect UUID Versions
uuid_version(x)uuid_version(x)
x |
Vector of UUID strings. |
An integer vector containing UUID version numbers, with NA for
invalid inputs.
x = c(uuid_v7(), uuid_v4(), "not-a-uuid") uuid_version(x)x = c(uuid_v7(), uuid_v4(), "not-a-uuid") uuid_version(x)