powered by
This function checks whether object is a specific class
has_class(x, class)
A logical scalar indicating x belongs to class
x
class
A value to check.
checks if x belongs to class. If multiple values of class are supplied, returns whether x belongs to any of them (character)
if(interactive()) { has_class(1, "numeric") # TRUE has_class(1, "character") # FALSE }
Run the code above in your browser using DataLab