r - split matrix by row into single array -


i split matrix has 2 columns array. have tested far splits column, e.g.

mat <- rbind(c(5, 9),              c(3, 7),              c(2, 1),              c(4, 3),              c(8, 6))  ind <- gl(1,10)  >split(mat, ind)  [1] 5 3 2 4 8 9 7 1 3 6 

but desired output is:

5 9 3 7 2 1 4 3 8 6 

there must super easy neat trick this. pointers highly appreciated, thanks!

you can use as.vector:

## presently have as.vector(mat)   [1] 5 3 2 4 8 9 7 1 3 6  ## looking as.vector(t(mat)) #  [1] 5 9 3 7 2 1 4 3 8 6 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -