Re: [R] Re-arrange Columns in data frame

2009-11-25 Thread Jabez Wilson
Thanks very much. Using the matrix function and then DF[,ix] gives me exactly what I wanted. Jabez --- On Wed, 25/11/09, Gabor Grothendieck wrote: From: Gabor Grothendieck Subject: Re: [R] Re-arrange Columns in data frame To: "Jabez Wilson" Cc: "R Mailing List" Date: We

Re: [R] Re-arrange Columns in data frame

2009-11-25 Thread Gabor Grothendieck
Try this: # first case ix <- c(matrix(1:24, 4, byrow = TRUE)) DF[ix] # second case ix <- c(matrix(1:16, 4, byrow = TRUE)) DF[ix] On Wed, Nov 25, 2009 at 11:16 AM, Jabez Wilson wrote: > Hi, I have a data frame which is 24 columns by 10 rows. This is essentially > 6 groups of 4 columns. I want t

[R] Re-arrange Columns in data frame

2009-11-25 Thread Jabez Wilson
Hi, I have a data frame which is 24 columns by 10 rows. This is essentially 6 groups of 4 columns. I want to re-arrange the columns into the following order 1,7,13,19,2,8,14,20,3,9,15,21,4,10,16,22,5,11,17,23,6,12,18,24 i.e. first of each group of 6 grouped together, then 2nd of each group of si