Re: [R] Altering columns

2009-06-18 Thread Jim Nemesh
A simple way to do it would be: mat<-mat[,c(2,1)] Slightly more fancy (for any number of columns): mat<-mat[,dim(mat)[2]:1] I'm sure there are prettier ways to do it. -Jim On Jun 18, 2009, at 4:14 PM, RON70 wrote: Hi, Suppose I have following dataset : mat <- matrix(rnorm(100), 50) Now

Re: [R] Altering columns

2009-06-18 Thread David Winsemius
mat[ , 2:1] On Jun 18, 2009, at 4:14 PM, RON70 wrote: Hi, Suppose I have following dataset : mat <- matrix(rnorm(100), 50) Now I want to put 2nd column in the place of 1st and 1st column in the place of 2nd. Is there any "quick" way to do that? Thanks and regards, -- View this message

[R] Altering columns

2009-06-18 Thread RON70
Hi, Suppose I have following dataset : mat <- matrix(rnorm(100), 50) Now I want to put 2nd column in the place of 1st and 1st column in the place of 2nd. Is there any "quick" way to do that? Thanks and regards, -- View this message in context: http://www.nabble.com/Altering-columns-tp2409959