[R] Set without argument

Christophe Genolini cgenolin at u-paris10.fr
Sat Feb 23 12:07:16 CET 2008


Hi the list,

I am defining S4 objet. Is it possbile to define a method that change 
the slot of an object without using <- ?
My object contain a numeric and a matrix. At some point, I would like to 
impute the missing value in the matrix. So I would like to use something 
like :

-----------------
setClass("MyObj",representation(time="numeric",traj="matrix"))
a <- new("MyObj",time=3,traj=matrix(c(1:6,NA,8:12),ncol=3))
imputeMyObj(a)
-----------------

I find 'setTime<-' to change le slot time, but it can not work in the 
case of imputeMyObs since this mehod does not need a value...

Any solution ?

Thanks

Christophe



More information about the R-help mailing list