Skip to contents

Check for Object Type Mismatch

Usage

check_object_type(x, type)

Arguments

x

Input Object

type

Object type

Value

A stop error if the input object and type does not match.

Details

This function is used to check the object type of an input value based on base R package. In base R package, object type functions are specified in is.ObjectType format. For instance, base::is.logical is used for checking a logical/Boolean value. Please see the examples how it is translated in this function.

Examples

if (FALSE) { # \dontrun{
check_object_type(x = letters[1:12], type = "character")
check_object_type(x = ADNIMERGE2::CDR, type = "data.frame")
check_object_type(x = TRUE, type = "logical")
# Error message
check_object_type(x = letters[1:12], type = "numeric")
check_object_type(x = letters[1:12], type = "factor")
} # }