Re: [R] Outputting csv file from dataframe with columns in a particular order

2011-01-12 Thread analys...@hotmail.com
Thanks to all who responded. On Jan 12, 10:34 am, Peter Ehlers wrote: > On 2011-01-12 07:16, analys...@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

Re: [R] Outputting csv file from dataframe with columns in a particular order

2011-01-12 Thread Peter Ehlers
On 2011-01-12 07:16, analys...@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

Re: [R] Outputting csv file from dataframe with columns in a particular order

2011-01-12 Thread Ivan Calandra
Hi! Let's say your data.frame is called df and that you want column 1, then column 4, then 3 and then 2: df <- data.frame(ID=LETTERS[1:5], date=rnorm(5), estimate=rnorm(5), actual=rnorm(5)) write.csv(df[c(1,4,3,2)], file="df.csv") HTH, Ivan Le 1/12/2011 16:16, analys...@hotmail.com a écrit :