R/misc.R
isUndefined.Rd
You can pass multiple strings, which are all checked. If any of them is undefined, the function returns TRUE
isUndefined(s, ..., verbose = TRUE)
A string to be checked for NA/NULL
More strings to be checked
If TRUE and 's' is NULL/NA, will print the name of the variable which was passed in
isUndefined(NA) ## TRUE
#> Warning: Variable 'NA' is NA/NULL!
#> [1] TRUE
isUndefined(NULL) ## TRUE
#> Warning: Variable 'NULL' is NA/NULL!
#> [1] TRUE
isUndefined(NA, NULL) ## TRUE
#> Warning: Variable 'NA' is NA/NULL!
#> Warning: Variable 'NULL' is NA/NULL!
#> [1] TRUE
isUndefined("") ## FALSE
#> [1] FALSE
isUndefined("", NA) ## TRUE
#> Warning: Variable 'NA' is NA/NULL!
#> [1] TRUE
isUndefined(NA, "") ## TRUE
#> Warning: Variable 'NA' is NA/NULL!
#> [1] TRUE
isUndefined(1) ## FALSE
#> [1] FALSE
myVar = NA
isUndefined(myVar) ## TRUE, with warning "Variable 'myVar' is NA/NULL!"
#> Warning: Variable 'myVar' is NA/NULL!
#> [1] TRUE