[R] Writing out data

Thomas thomas.chesney at nottingham.ac.uk
Thu Feb 2 12:40:05 CET 2012


What is the best way to write out comma separated data, as a program  
is running (rather than waiting to the end using write.csv)? At the  
moment I'm doing this, but I guess it's not the most efficient. The  
data is in a column in the matrix postcount, and I'm using a loop to  
write out each of the 100 elements.

for (j in 1:100)
{
cat(postcount[1,j], ",", file=filename, append=TRUE)
}
cat("\n", file=filename, append=TRUE)


Thank you!

Thomas

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.



More information about the R-help mailing list