[R] Automation: Batch mode or Loop?

From: Stropharia <stevenworthington_at_hotmail.com>
Date: Fri, 28 Mar 2008 17:42:39 -0700 (PDT)

R users,

I've been searching around for a solution to this for a few days, any help would be appreciated.

I have working R code (a custom function) that transforms 3D coordinate data into angles (between any three sets of coordinates). The code outputs a single scalar (an angle). For my research I will have several hundred .csv files containing coordinate data - each file is a set of coordinates on an organism. I would like to run the code on each of these files in turn and then output the resulting angles to a new .csv file, appending that file with a new scalar each time the code completes it's operation. Ideally, at the end I would have a new .csv file with a single column with several hundred scalars - which are the results of the analysis on each individual coordinate data file.

I am using R on OS X (Leopard), ver. 2.6.2. I generally use the console.

Is it possible to automate this series of operations, so that several hundred .csv coordinate data files placed in one folder could be sequentially analyzed? If so, would it be best to do this in "Batch Mode" or interactively using a loop? I don't understand how to run batch mode from the terminal on OS X (online instructions seem to be for linux or windows). I've read about using the Source and Sink commands, but this seems only for interactive use, and sink seems to output only to .txt files. I have tried output as write.csv and this works for a single file, but I don't understand how to automate it. Thanks.


View this message in context: http://www.nabble.com/Automation%3A-Batch-mode-or-Loop--tp16365096p16365096.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sat 29 Mar 2008 - 00:51:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 29 Mar 2008 - 02:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive