is.xlt: is.xlt

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

View source: R/is.xlt.R

Description

is.xlt tests whether the function argument is a vector of 32 digit hexadecimal numbers (a "hexlet").

Usage

1
is.xlt(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.xlt accepts a vector of strings and returns a logical vector of the same length, TRUE for every element of the input that matches the regular expression "^[0-9a-f]{32}$". 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.

Value

(logical) a vector of the same length as the input, TRUE for every element of the input that is a valid UUID, FALSE for every element that is not, and NA or FALSE for every NA input.

Author(s)

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

See Also

is.QQID() to check QQIDs.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# check the example hexlet formats
is.xlt(xltIDexample())              # TRUE  TRUE  TRUE  TRUE  TRUE

# check one invalid format
is.xlt("2.718281828459045235360287471353")     # FALSE

# check a valid hexlet, an invalid hexlet, and an NA.
# Map input NA to NA, not to FALSE.
is.xlt(c("0c46:0ed3:b015:adc2:ab4a:01e0:9336:4f1f", # IPv6
         "c46:ed3:b015:adc2:ab4a:1e0:9336:4f1f",    # IPv6 abbreviated format
         NA), na.map = NA)                          # TRUE  FALSE  NA

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