Skip to content
Prev 327295 / 398503 Next

Check the class of an object

On 07/23/2013 09:59 AM, Simon Zehnder wrote:
you said you were you were using S4 classes. S4 classes do not report vectors of 
length != 1, from ?class

      For objects which have a formal class, its name is returned by 'class'
      as a character vector of length one

so a first unit test could be

   stopifnot(length(class(myObject)) != 1L)