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

From: juli pausas <pausas_at_gmail.com>
Date: Thu, 26 Jun 2008 11:28:22 +0200


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 comment

Juli

--
http://www.ceam.es/pausas

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 26 Jun 2008 - 10:43:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 26 Jun 2008 - 11:31:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive