Writing to a file
Yes, Andy, the command you gave takes only a minute to output the whole data set to a file rather than mine, which takes hours to complete the file ouput operation. Thanks!
Liaw, Andy wrote:
Would the following do? x <- 1000 write.table(Info[Info[,4] > x, c(1, 4)], file="/tmp/CT.dat") Andy
From: Melanie Vida
Here is a simple question. Is there a quicker way to write to a file
several rows of data at a time rather than one line at a
time? How can
the code below be optimized to write several rows at a time to a file
rather than one line at a time. See my slow method of
write.table below:
---------------------------
x<-1000
for( i in 1:385420)
(
if(Info[i,4] > x)
write.table (cbind(Info[i,1], Info[i,4], file="/tmp/CT.dat",
append=TRUE, row.names=FALSE, col.names=FALSE)
Thanks,
-Melanie
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. ------------------------------------------------------------------------------