Skip to contents

Opposite of base::inherits(). Indicates whether its first argument inherits from any of the classes specified in the what argument. If which is TRUE then an integer vector of the same length as what is returned. Each element indicates the position in the class(x) matched by the element of what; zero indicates no match. If which is FALSE then TRUE is returned by inherits if any of the names in what match with any class.

Usage

not.inherits(x, what, which = FALSE)

Arguments

x

a R object

what

a character vector naming classes.

which

logical affecting return value: see ‘Details’.

Value

a boolean value to indicate if !inherits

Examples

keep.cols = "a character"
class(keep.cols) # class is character
#> [1] "character"
not.inherits(keep.cols,"character")
#> [1] FALSE

num.var = 1L
class(num.var) # class is integer
#> [1] "integer"
not.inherits(num.var,"double")
#> [1] TRUE