Description Usage Arguments Examples
Check if data is close to “valid"
1 2 3 4 5 6 7 8 9 |
x |
data to check |
min_len, max_len |
minimal and maximum length |
mode |
which storage mode (see |
na |
whether |
blank |
whether blank string considered invalid? |
all |
if |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # length checks
is_valid_ish(NULL) # FALSE
is_valid_ish(integer(0)) # FALSE
is_valid_ish(integer(0), min_len = 0) # TRUE
is_valid_ish(1:10, max_len = 9) # FALSE
# mode check
is_valid_ish(1:10) # TRUE
is_valid_ish(1:10, mode = 'numeric') # TRUE
is_valid_ish(1:10, mode = 'character') # FALSE
# NA or blank checks
is_valid_ish(NA) # FALSE
is_valid_ish(c(1,2,NA), all = FALSE) # FALSE
is_valid_ish(c(1,2,NA), all = TRUE) # TRUE as not all elements are NA
is_valid_ish(c('1',''), all = FALSE) # TRUE
is_valid_ish(1:3, all = FALSE) # TRUE as 1:3 are not characters
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.