[R] doing many commands within R

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Jan 10 14:24:04 CET 2005


Cserháti Mátyás wrote:

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

Debug! R has many tools for convenient debugging. See the manuals, R 
News, or some good book on R.

What can we do? We don't know anything about a) the files, b) the code 
and c) your intention!

Uwe Ligges

> Thanks, Matthew
> 
> ______________________________________________
> 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




More information about the R-help mailing list