check_class()
returns the class of the provided object data
as a string. If the class of data
cannot be determined due to an
error, the function returns the string "unknown"
.
Value
check_class()
: Returns a string representing the class ofdat
. If an error occurs while determining the class, it returns"unknown"
.
Examples
check_class(42)
#> [1] "numeric"
check_class("Hello")
#> [1] "character"
check_class(list(1, 2, 3))
#> [1] "list"
check_class(NA)
#> [1] "logical"
check_class(data.frame(a = 1:3, b = letters[1:3]))
#> [1] "data.frame"
try(check_class(function(x) x))
#> [1] "function"