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

juli pausas pausas at gmail.com
Thu Jun 26 11:28:22 CEST 2008

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 comment



More information about the R-help mailing list