[R] Set without argument

From: Christophe Genolini <cgenolin_at_u-paris10.fr>
Date: Sat, 23 Feb 2008 12:07:16 +0100


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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 23 Feb 2008 - 11:12:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 23 Feb 2008 - 14:00:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive