[R] Executing the same function on consecutive files

John Kane jrkrideau at yahoo.ca
Tue Jun 28 00:42:18 CEST 2011


This looks something like what you want.

http://r.789695.n4.nabble.com/Reading-in-a-series-of-files-using-a-for-loop-td906101.html

--- On Mon, 6/27/11, Trying To learn again <tryingtolearnagain at gmail.com> wrote:

> From: Trying To learn again <tryingtolearnagain at gmail.com>
> Subject: [R] Executing the same function on consecutive files
> To: r-help at r-project.org
> Received: Monday, June 27, 2011, 6:01 PM
> Hi all,
> 
> I have the next problem: I have a matrix with size
> 8,000,000x18. My personal
> computer...blocks...so I have cut my original file into 100
> different file.
> 
> I have written a function that should be run on each of
> this file.
> 
> So imagine
> 
> I need to read data from q1 to q100 file
> 
> data<-read.table("q1.txt",sep="")
> 
> and each time I read 1 file execute my personal function (I
> get some stats)
> and my last target is to add each partial stats...
> 
> My question is:
> 
> Is posible to say something similar to this?
> 
> for (i in 1:100){
> 
> data[i]<-read.table("q[i].txt", sep="")
> 
> execute .....
> 
> }
> 
> Many thanks in advance
> 
>     [[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.
>



More information about the R-help mailing list