Description Usage Arguments Details Value Author(s) See Also Examples
is.QQID
tests whether the function argument is a vector of valid
QQIDs.
1 |
s |
(character) a vector of strings to check. |
na.map |
(logical) replace NA with |
is.QQID
accepts a vector of strings and returns a logical vector of
the same length, TRUE
for every element of the input that is a valid
QQID. NA
values are mapped to FALSE
(default) or can be
replaced with NA
to preserve them. Note: arguments passed to
na.map
are implicitly converted to type logical. A valid QQID has the
form: "qqqq.qqqq.BBBBBBBBBBBBBBBBBB"
where each "qqqq"
is a
Q-word (cf. qMap()
) encoding 10 bit, and "B"
is a
Base64 character encoding 6 bits each for 10 + 10 + (18 * 6) == 128
bits. The two Q-words of the QQID are separated by a "." which does not
appear in UUIDs nor in the Base64 alphabet and thus the Q-words bead, beef,
dead, deaf, deed, face, and fade can be easily distinguished from 4 digit
hexadecimal numbers in a QQID or a Base64 encoded number.
(logical) a vector of the same length as the input, TRUE
for
every element of the input that is a valid QQID.
(c) 2019 Boris Steipe,
licensed under MIT (see file LICENSE
in this package).
is.xlt()
to check UUIDs, MD5s, IPv6 addresses
and other hexlets.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # check one invalid QQID
is.QQID("spur.ious.oversimplification") # FALSE: "ious" is not a Q-word
# check one valid QQID
is.QQID("base.less.Anthr0p0centricity") # TRUE, perhaps regrettably so
# check two valid QQIDs
is.QQID(QQIDexample(1:2)) # TRUE TRUE
# convert a UUID and check it
is.QQID(xlt2qq("0c460ed3-b015-adc2-ab4a-01e093364f1f")) # TRUE
# check a valid QQID, not a QQID, and an NA. Map NA to NA, not to FALSE.
is.QQID(c(QQIDexample(3), "meh", NA), na.map = NA) # TRUE FALSE NA
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.