Test if a value is missing, empty, or contains only NA or NULL values

Share:

Description

Test if a value is missing, empty, or contains only NA or NULL values.

Usage

1

Arguments

x

value to be tested

Value

Logical value.

Author(s)

Gregory R. Warnes greg@warnes.net

See Also

missing, is.na, is.null

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
invalid(NA)
invalid()
invalid(c(NA,NA,NULL,NA))

invalid(list(a=1,b=NULL))

# example use in a function
myplot <- function(x,y) {
                if(invalid(y)) {
                        y <- x
                        x <- 1:length(y)
                }
                plot(x,y)
        }
myplot(1:10)
myplot(1:10,NA)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.