[R] Matrix to "indexed" vector

Sean Davis sdavis2 at mail.nih.gov
Tue Jan 11 14:00:25 CET 2005


On Jan 11, 2005, at 7:55 AM, Dimitris Rizopoulos wrote:

> mat <- rnorm(9); dim(mat) <- c(3,3)
> mat
> ###########
> cbind(i=rep(1:nrow(mat), each=ncol(mat)),
>                j=rep(1:ncol(mat), nrow(mat)), value=c(t(mat)))
>
That will do it.  Thanks!

Sean




More information about the R-help mailing list