RE: [R] Writing to a file

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Tue 08 Mar 2005 - 05:15:10 EST


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@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
>
>
>



R-help@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 Received on Tue Mar 08 05:20:19 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:41 EST