Message-ID: <4E871F2C.8020306@statistik.tu-dortmund.de>
Date: 2011-10-01T14:09:48Z
From: Uwe Ligges
Subject: class definition
In-Reply-To: <1317468110.78375.YahooMailNeo@web124916.mail.ne1.yahoo.com>
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.