gtools (version 3.5.0)

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

Description

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

Usage

invalid(x)

Arguments

x
value to be tested

Value

Logical value.

See Also

missing, is.na, is.null

Examples

Run this code

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)

Run the code above in your browser using DataLab