Skip to content

[Bioc-devel] adding a validity method to a class

1 message · Paul Shannon

#
Combining suggestions from Herv? and Steve Lianoglou, my confusion is cleared up.  The custom validity function has to be defined before it is named in the class definition.

This works:

   myValidity = function (object) cat ('hello from myValidity')
   setClass ("A", representation(blob="raw") , validity=myValidity)
   a <- new ("A")
   print (validObject(a))

I expected the reference to the method to be resolved dynamically when validObject was first called.  Not so.

Thanks to everyone who helped on this.

 - Paul
On Mar 31, 2011, at 12:08 PM, Herv? Pag?s wrote: