[R] Converting a Matrix in a colum vector

Benilton Carvalho bcarvalh at jhsph.edu
Fri Dec 4 17:00:36 CET 2009


matrix(t(G), nc=1)

b

On Dec 4, 2009, at 1:19 PM, Jose Narillos de Santos wrote:

> Hi all,
> 
> Imagine I have a matrix G
> 
> with N rows
> 
> and M columns
> 
> So L=NxM is the number of different cells in my  matrix.
> 
> I want to create a column vector F whose size will be F(L,1)
> 
> So the fisrt row in F is G(1,1)
> Second row in F is G(1,2)
> When we arrive to a point M
> the element M+1 will be G(2, 1)
> Element M+2 will be G(2,2) and so on.
> 
> I´m trying but allways error....
> 
> Easy Example:
> 
> 
> G=
> 2 3 4
> 8 8 9
> 
> 
> N=2
> M=3
> L=6
> 
> F=
> 2
> 3
> 4
> 8
> 8
> 9
> 
> Can anyone guide me?
> 
> 
> Thanks in advance
> 
>        [[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.




More information about the R-help mailing list