[R] as(obj,"matrix")

Wolski
Wed, 28 Jul 2004 15:18:30 -0000

The definition of dd is.
dd<-matrix(0,2,2)


*********** REPLY SEPARATOR  ***********

On 7/28/2004 at 4:12 PM Adaikalavan Ramasamy wrote:

>>>On Wed, 2004-07-28 at 15:55, Wolski wrote:
>>>> Hi!
>>>>
>>>> Here a simple example.
>>>>
>>>> setClass("myclass"
>>>> ,representation(info="character")
>>>> ,contains="matrix"
>>>> )
>>>>
>>>> rownames(dd)<-c("a","b")
>>>
>>>Er, I don't think you have defined 'dd' in the example.
>>>
>>>> tt<-new("myclass",dd)
>>>> #the source of pain.
>>>> as(tt,"matrix")<-matrix(1,3,3)
>>>> Error: length of dimnames [1] not equal to array extent
>>>>
>>>>
>>>> Is there a different way to do what I would like to do (I would
like
>>>to change the @.Data and all its attributes in the object)?
>>>>
>>>>
>>>> Eryk.
>>>>
>>>> ______________________________________________
>>>> R-help at stat.math.ethz.ch mailing list
>>>> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide!
>>>http://www.R-project.org/posting-guide.html
>>>>



Dipl. bio-chem. Eryk Witold Wolski    @    MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin       'v'
tel: 0049-30-83875219               /   \
mail: wolski at molgen.mpg.de        ---W-W----