Re: [R] Reorder data frame columns by negating list of names

2008-02-12 Thread Barry Rowlingson
Thompson, David (MNR) wrote: > Hello, > > I would like to reorder columns in a data frame by their names as > demonstrated below: > > Take this data frame: > > xxx <- data.frame(matrix(1:40, ncol=8)) > > names(xxx) <- letters[1:8] > > xxx > a b c d e f g h >

Re: [R] Reorder data frame columns by negating list of names

2008-02-12 Thread jim holtman
try this: > x <- read.table(textConnection(" a b c d e f g h +1 1 6 11 16 21 26 31 36 +2 2 7 12 17 22 27 32 37 +3 3 8 13 18 23 28 33 38 +4 4 9 14 19 24 29 34 39 +5 5 10 15 20 25 30 35 40"), header=TRUE) > # initial columns > init.cols <- c('b',

Re: [R] Reorder data frame columns by negating list of names

2008-02-12 Thread Dimitris Rizopoulos
t;Thompson, David (MNR)" <[EMAIL PROTECTED]> To: Sent: Tuesday, February 12, 2008 6:19 PM Subject: [R] Reorder data frame columns by negating list of names > Hello, > > I would like to reorder columns in a data frame by their names as > demonstrated below: > > Tak

[R] Reorder data frame columns by negating list of names

2008-02-12 Thread Thompson, David (MNR)
Hello, I would like to reorder columns in a data frame by their names as demonstrated below: Take this data frame: > xxx <- data.frame(matrix(1:40, ncol=8)) > names(xxx) <- letters[1:8] > xxx a b c d e f g h 1 1 6 11 16 21 26 31 36 2 2 7