is.QQID: is.QQID

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/is.QQID.R

Description

is.QQID tests whether the function argument is a vector of valid QQIDs.

Usage

1
is.QQID(s, na.map = FALSE)

Arguments

s

(character) a vector of strings to check.

na.map

(logical) replace NA with FALSE (default), NA, or TRUE

Details

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.

Value

(logical) a vector of the same length as the input, TRUE for every element of the input that is a valid QQID.

Author(s)

(c) 2019 Boris Steipe, licensed under MIT (see file LICENSE in this package).

See Also

is.xlt() to check UUIDs, MD5s, IPv6 addresses and other hexlets.

Examples

 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

qqid documentation built on May 2, 2019, 12:19 p.m.