[R] Large matrix into a vector
Alberto Monteiro
albmont at centroin.com.br
Wed Mar 28 19:39:50 CEST 2007
A Ezhil wrote:
>
> I have a matrix HR(9x27). I would like to make a
> single vector with elements: t(HR[,1]) followed by
> t(HR[,2]) and then t(HR[,3] ... etc. Is there any neat
> way of converting this matrix into a vector rather
> doing something like c(t(HR[,1]), t(HR[,2]), t(HR[,3])
> ..)?
>
It might be simpler than you thought...
HR <- matrix(1:(9*27), nrow=9) # just to create a 9x27 matrix
c(HR) # oops, here it is!
Alberto Monteiro
More information about the R-help
mailing list