Has attribute or name?

has_attr(x, which)

x %has_attr% which

has_name(x, which)

x %has_name% which

Arguments

x

object to test

which

name or attribute

Examples

has_attr(has_attr, "fail")
#> [1] TRUE
x <- 10
x %has_attr% "a"
#> [1] FALSE

y <- list(a = 1, b = 2)
see_if(y %has_name% "c")
#> [1] FALSE
#> attr(,"msg")
#> [1] "y does not have all of these name(s): 'c'"