[R] iterative output to file by row

From: Christina Yau <cyau_at_buckinstitute.org>
Date: Tue 11 Oct 2005 - 10:04:21 EST


Hi,  

I'm sort of a newbie to using R to deal with array data. I'm trying to create a simple filtering function, which outputs only the rows of a data frame that satisfies a specific criterion. I've set up an iterative loop to apply the condition to each row. I can create a new matrix and use rbind to fill it in row by row in the loop, before writing the whole matrix to file. But it seems really inefficient, especially considering my very large dataset. In fact, I'm worried it will cause memory problems if I run the function on the full data set.  

Each row is from a data frame and is associated with a row name and a column name. I'm wondering if there's a way to write each row that satisfy the condition to file within the iterative loop directly, while keeping the data structure. I've read the help on the 'cat' function; but I'm still not entirely sure how to use it in my situation, or if it is the correctly function to use. Any advice will be greatly appreciated.  

Thanks,

Christina          

        [[alternative HTML version deleted]]



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 Oct 11 10:10:46 2005

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