Learn R Programming

lares (version 5.0.6)

check_attr: Attribute checker

Description

This function checks if an object has a specific attribute and stops if not

Usage

check_attr(object, attr = "type", check = NULL, stop = TRUE)

Arguments

object

Object of any kind

attr

Character. Attribute to check

check

Character. Attribute value

stop

Boolean. Stop if doesn't check?

Value

No return value, called for side effects.

Examples

Run this code
# NOT RUN {
test <- data.frame()
attributes(test)
check_attr(test, "class", "data.frame")
# check_attr(test, "class", "not.data.frame")
# }

Run the code above in your browser using DataLab