Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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.

Author(s)

Gregory R. Warnes greg@warnes.net

See Also

Examples

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)

gtools

Various R Programming Tools

v3.8.2
GPL-2
Authors
Gregory R. Warnes, Ben Bolker, and Thomas Lumley
Initial release
2020-03-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.