[R] repeating the same procedure with a number of files within a directory

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Sep 3 16:20:37 CEST 2006



Ffenics wrote:
> Hi there I am very new to R so dont know much about the programming
> side of thing yet. I've worked out how to input a data matrix, create
> distance matrices and print them to an external file but only for one
> data matrix at a time.
> 
> I actually have a batch of data matrices for which I want to create
> distance matrices for each in turn and then print these distance
> matrices to their respective external files. (I'm wanting them
> printed as CSV files for processing in excel).
> 
> How easy is it to get R to read in files one at a time from a
> directory and do the same thing with all of those files in turn? And
> could someone please give me some advice as to how I may go about
> achieving this if its possible? It would be much appreciated


This is asked very frequently on this list, please do as the posting 
guide suggests:

Read the FAQs (in particular "How can I save the result of each 
iteration in a loop into a separate file?"),
and search the mailing list archives.

You can read ?list.file for your particular problem.

Uwe Ligges


> [[alternative HTML version deleted]]
> 
> ______________________________________________ 
> 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 and provide
> commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list