Skip to content
Prev 327291 / 398502 Next

Check the class of an object

On Jul 23, 2013, at 5:36 AM, Simon Zehnder wrote:

            
I would think that you would need to use `%in%` instead. 

 if( "firstClass" %in% class(myObject) ){

 Objects can have more than one class, so testing with "==" would fail in those instances.
Well, `inherits` IS the usual way.
Plain-text format is the recommended format for Rhelp