Learn R Programming

qqid (version 1.0.3)

is.xlt: is.xlt

Description

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

Usage

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

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.

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.

See Also

is.QQID() to check QQIDs.

Examples

Run this code
# NOT RUN {
# 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

# }

Run the code above in your browser using DataLab