[R] Outputting csv file from dataframe with columns in a particular order
ehlers at ucalgary.ca
Wed Jan 12 16:34:11 CET 2011
On 2011-01-12 07:16, analyst41 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
Let's say that your data.frame is DF.
mynames <- c("ID", "date", "estimate", "actual")
write.csv(DF[, mynames], ....)
More information about the R-help