Re: [R] how to vectorize a matrix

From: Christian Ritz <>
Date: Mon 22 May 2006 - 19:17:32 EST

Hi Lorenzo,

maybe the following example is of use?

a <- matrix(1:25,5,5)

stack([, c(1,3,5,2,4)]))

Note that 'stack' takes a data frame or list as first argument (not a matrix). Therefore the matrix is first converted to a data frame using ''.

Christian mailing list PLEASE do read the posting guide! Received on Mon May 22 19:29:30 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 22 May 2006 - 22:10:15 EST.

Mailing list information is available at Please read the posting guide before posting to the list.