[R] Loss of rownames and colnames

Sean Davis sdavis2 at mail.nih.gov
Fri Aug 20 20:13:45 CEST 2004


Min-Han,

Have you considered using lists of matrices?  You can make a list of
matrices by:

mymatlist <- list()
for (i in 1:10) {a <- matrix(rnorm(100),nrow=10)
  mymatlist[[i]] <- a
}

Now, mymatlist[[1]] is the first matrix (with rownames and colnames if there
were any), mymatlist[[2]] the second, etc.

Sean

----- Original Message -----
From: "Min-Han Tan" <minhan.science at gmail.com>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, August 20, 2004 1:46 PM
Subject: [R] Loss of rownames and colnames


> Hi,
>
> I am working on some microarray data, and have some problems with
> writing iterations.
>
> In essence, the problem is that objects with three dimensions don't
> have rownames and colnames. These colnames and rownames would
> otherwise still be there in 2 dimensional objects.
>
> I need to generate multiple iterations of a 2 means-clustering
> algorithm, and these objects thus probably need 3 dimensions.
>
> My scripts are all written with heavy references to matching of
> colnames and rownames, so I am running into some problems here.
> (colnames = sample ids, and rownames = gene ids)
>
> My bad workaround solution so far has been to generate objects tagged
> with ".2", and have multiple blocks of code.
>
> e.g.
>
> test.1 <- ...
>
> test.2 <- ...
>
> test.x <- ..
>
> The obvious problem with this solution is that there does not seem to
> be an easy way of manipulating all these objects together without
> typing out their names individually.
>
> Thanks for any advice.
>
> Regards,
> Min-Han
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list