I am looping over a data set and at each loop I am creating a dataframe ?mydata? That I wanted to be saves in a .csv file, but I want all the results to be saved in the same file and this is the way I do it write.csv(mydata, file= ?data.csv?=F, append=T) . the csv file looks fine but I always get the following warning message Warning messages: 1: In write.table(mydata, file =?data.csv?, ... : appending column names to file Does anyone see why R print out this warning message? -- View this message in context: http://www.nabble.com/Append-to-a-csv-file-tp23145471p23145471.html Sent from the R help mailing list archive at Nabble.com.
On Apr 20, 2009, at 5:39 PM, kayj wrote:> > I am looping over a data set and at each loop I am creating a > dataframe > ?mydata? > That I wanted to be saves in a .csv file, but I want all the results > to be > saved in the same file and this is the way I do it > > write.csv(mydata, file= ?data.csv?=F, append=T) . the csv file looks > fine > but I always get the following warning message > > > Warning messages: > 1: In write.table(mydata, file =?data.csv?, ... : > appending column names to file > > > Does anyone see why R print out this warning message?Have you looked at the help page for write.csv? The answer rather leaps out of the page at you. It's telling you that mixed in with your data will be a bunch of column names. -- David Winsemius, MD Heritage Laboratories West Hartford, CT
Try writing to a connection so that the file stays opens. On Mon, Apr 20, 2009 at 5:39 PM, kayj <kjaja27 at yahoo.com> wrote:> > I am looping over a data set and at each loop I am creating a dataframe > ?mydata? > That I wanted to be saves in a .csv file, but I want all the results to be > saved in the same file and this is the way I do it > > write.csv(mydata, file= ?data.csv?=F, append=T) . the csv file looks fine > but I always get the following warning message > > > Warning messages: > 1: In write.table(mydata, file =?data.csv?, ?... : > ?appending column names to file > > > Does anyone see why R print out this warning message? > > > > > -- > View this message in context: http://www.nabble.com/Append-to-a-csv-file-tp23145471p23145471.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
Maybe each dataframe you are adding during the loop include the column name.
I would add
write.csv(mydata, file= “data.csv”=F, append=T,col.names=F)
Hope that help
Carlos
________________________________
To: r-help@r-project.org
Sent: Monday, April 20, 2009 4:39:48 PM
Subject: [R] Append to a csv file
I am looping over a data set and at each loop I am creating a dataframe
“mydata”
That I wanted to be saves in a .csv file, but I want all the results to be
saved in the same file and this is the way I do it
write.csv(mydata, file= “data.csv”=F, append=T) . the csv file looks fine
but I always get the following warning message
Warning messages:
1: In write.table(mydata, file =”data.csv”, ... :
appending column names to file
Does anyone see why R print out this warning message?
--
View this message in context:
http://www.nabble.com/Append-to-a-csv-file-tp23145471p23145471.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help@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.
[[alternative HTML version deleted]]