Outputting csv file from dataframe with columns in a particular order
Thanks to all who responded.
On Jan 12, 10:34?am, Peter Ehlers <ehl... at ucalgary.ca> wrote:
On 2011-01-12 07:16, analys... at hotmail.com wrote:
I have a dataframe with columns "ID",'date","estimate","actual" (but not necessarily in that order - I do a merge somewhere and that somehow messes up the order of the columns).
How can I output it to a csv file with the columns in the order that I want?
Let's say that your data.frame is DF.
mynames <- c("ID", "date", "estimate", "actual")
write.csv(DF[, mynames], ....)
Peter Ehlers
______________________________________________ R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.