has_attr: Has attribute or name?

Description Usage Arguments Examples

Description

Has attribute or name?

Usage

1
2
3
4
5
6
7
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

1
2
3
4
5
6
has_attr(has_attr, "fail")
x <- 10
x %has_attr% "a"

y <- list(a = 1, b = 2)
see_if(y %has_name% "c")

Example output

[1] TRUE
[1] FALSE
[1] FALSE
attr(,"msg")
[1] "y does not have name c"

assertthat documentation built on May 1, 2019, 10:25 p.m.