UUIDgenerate | R Documentation |
UUIDgenerate
generates new Universally Unique Identifiers. It
can be either time-based or random.
UUIDfromName
generates deterministic UUIDs based on namespace
UUID and a name (UUID version 3 and 5).
UUIDparse
parses one of more UUIDs in string form and converts
them to other internal formats.
UUIDvalidate
checks the valitiy of UUIDs in string form.
UUIDgenerate(use.time = NA, n = 1L, output = c("string", "raw", "uuid"))
UUIDfromName(namespace, name, type = c("sha1", "md5"),
output = c("string", "raw", "uuid"))
UUIDparse(what, output = c("uuid", "string", "raw", "logical"))
UUIDvalidate(what)
use.time |
logical, if |
n |
integer, number of UUIDs to generate. |
output |
type of the output. Valid types are: |
namespace |
UUID defining the namespace |
name |
character vector of names to use for generating UUIDs. The result will yield as many UUIDs as there are elements in this vector. |
type |
string, type of the hash function to use when generating the UUIDs. "sha1" is recommended (version 5 UUID), "md5" is available for compatibility (version 3 UUID). |
what |
character vector which will be parsed into UUIDs. |
UUIDgenerate
, UUIDfromName
and UUIDparse
values
depend on the output
argument as follows:
"string" |
character vector with each element UUID in
lowercase form, for |
"raw" |
raw vector with the UUIDs stores each as 16 bytes seqeuntially. If the output is more than one UUID then the result is a raw matrix with 16 rows and as many columns as there are input elements. |
"uuid" |
object of the class |
"logical" |
only supported in |
UUIDvalidate
is just a shorthand for
UUIDparse(what, output="logical")
.
The first argument is not n
for historical reasons, beause the
first version did only generate a single UUID.
Simon Urbanek, based on libuuid by Theodore Ts'o.
UUIDgenerate()
UUIDgenerate(TRUE)
UUIDgenerate(FALSE)
## see if the randomness is any good
length(unique(UUIDgenerate(n=1000)))
## generate a native UUID vector
(u <- UUIDgenerate(n=3, output="uuid"))
as.character(u)
as.raw(u[1])
UUIDgenerate(output="raw")
## UUID for DNS namespace
DNS.namespace <- "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
## SHA1 (v5) - default
UUIDfromName(DNS.namespace, "r-project.org")
## MD5 (v3)
UUIDfromName(DNS.namespace, "r-project.org", type="md5")
## see ?UUID for more examples on UUID objects
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.