[R] write.table a df with specific column order

2008-06-26 Thread juli pausas
Hi I'd like to write.table a dataframe, but with an specific order of columns. Is there a direct way to do it? or I have to generate a new dataframe as follows: t - data.frame(c=1:10, b=11:20, a=letters[1:10]) t2 - data.frame(a=t$a, b=t$b, c=t$c) write.table(t2, row.names=F) Thanks for any

Re: [R] write.table a df with specific column order

2008-06-26 Thread Henrique Dallazuanna
Try: write.table(t[c(a, b, c)], row.names=F) On Thu, Jun 26, 2008 at 6:28 AM, juli pausas [EMAIL PROTECTED] wrote: Hi I'd like to write.table a dataframe, but with an specific order of columns. Is there a direct way to do it? or I have to generate a new dataframe as follows: t -

Re: [R] write.table a df with specific column order

2008-06-26 Thread Don MacQueen
Minor correction -- omitted comma. Should be: write.table(t[ , c(a, b, c)], row.names=FALSE) Also, using the name t should be avoided, because t is a built-in function: t() -Don At 8:02 AM -0300 6/26/08, Henrique Dallazuanna wrote: Content-Type: text/plain Content-Disposition: inline