Re: [R] Validity check when setting slot

2009-08-14 Thread Renaud Gaujoux
It looks like a sound solution. Thanks Vitalie. Vitalie S. wrote: Hi, RG Hi, RG I'm wondering if the following behaviour is normal: RG setClass('A', representation(number='numeric'), RG validity=function(object){ RG if( obj...@number -1 ) return(Invalid number);

Re: [R] Validity check when setting slot

2009-08-13 Thread Vitalie S.
Hi, RG Hi, RG I'm wondering if the following behaviour is normal: RG setClass('A', representation(number='numeric'), RG validity=function(object){ RG if( obj...@number -1 ) return(Invalid number); TRUE}) [1] A RG a - new('A') RG a An object of class

[R] Validity check when setting slot

2009-08-10 Thread Renaud Gaujoux
Hi, I'm wondering if the following behaviour is normal: setClass('A', representation(number='numeric'), validity=function(object){ if( obj...@number -1 ) return(Invalid number); TRUE}) [1] A a - new('A') a An object of class “A” Slot number: numeric(0) a...@number - 0 a...@number - -3 a An

Re: [R] Validity check when setting slot

2009-08-10 Thread Martin Maechler
RG == Renaud Gaujoux ren...@mancala.cbio.uct.ac.za on Mon, 10 Aug 2009 17:19:12 +0200 (SAST) writes: RG Hi, RG I'm wondering if the following behaviour is normal: RG setClass('A', representation(number='numeric'), RG validity=function(object){ RG if( obj...@number -1

Re: [R] Validity check when setting slot

2009-08-10 Thread Renaud Gaujoux
Hi Martin, Indeed the validObject works, but I was expecting it to be called automatically after a slot assignment. I understand the fact that during their construction, objects' slots are sometime not valid, and thought the check=FALSE was there for such cases. My validity method needs to