[R] Automation: Batch mode or Loop?

Stropharia stevenworthington at hotmail.com
Sat Mar 29 01:42:39 CET 2008


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.

Steve
-- 
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.



More information about the R-help mailing list