Learn R Programming

rapport (version 0.3)

is.empty: Empty Value

Description

Rails-inspired helper that checks if value is "empty", i.e. if it's of NULL, NA, NaN, FALSE, empty string or 0.

Usage

is.empty(x, trim = FALSE, ...)

Arguments

x
an object to check
trim
trim whitespace? (by default removes only trailing spaces)
...
additional arguments for trim.space

Examples

Run this code
is.empty(NULL)     # returns [1] TRUE
is.empty(NA)       # returns [1] TRUE
is.empty(NaN)      # returns [1] TRUE
is.empty("")       # returns [1] TRUE
is.empty(0)        # returns [1] TRUE
is.empty(0.00)     # returns [1] TRUE
is.empty("foobar") # returns [1] FALSE
is.empty("")   # returns [1] FALSE

Run the code above in your browser using DataLab