[R] doing many commands within R

Cserháti Mátyás cs_matyi at freemail.hu
Mon Jan 10 13:55:28 CET 2005



Dear all,

I'm new to this list, so let me greet everyone.

My problem is that I have several thousand data files which I want to 
perform a lot of R commands on, which are found in a seperate .R script.

Now, what I did was within the R prompt, I used to read in a list of the 
data files. 

e.g. 

namelist <- readLines("list_of_names",n=-1)
for (i in 1:100) {
k <- function(namelist[i])
write(k,file="outputfile",append=TRUE)
}

Next, I tried automating the R commands by making a loop. Within the 
loop I called the R-script. Within ecery single loop R called the R-script 
and performs the commands therein (or is supposed to perform it) on 
the actual data file.

After a loop finished, I tried appending the output to an output file.

The problem is that R gives an error message saying that it cannot 
open the input files.

What can I do?

Thanks, Matthew




More information about the R-help mailing list