On 01.10.2011 13:21, Omphalodes Verna wrote:> Hi everybody!
>
> I have a matrix of class "myClass", for example:
>
> myMat<- matrix(rnorm(30), nrow = 6)
> attr(myMat, "class")<- "myClass"
> class(myMat)
>
> When I extract part of ''myMat'', the corresponding class
''myClass'' unfortunately disappear:
>
> myMat.p<- myMat[,1:2]
> class(myMat.p)
>
> Please for any advice / suggestions, how define class, that during an
operation does not disappear.
You will need a "[" method for your class.
Uwe Ligges
>
> Thanks, OV
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.