[R] many datasets run with one R script in a computer cluster

Martin Hughes M.Hughes at bath.ac.uk
Fri Oct 8 18:33:21 CEST 2010


Hello Everyone

I have an R script (and a source file which I keep my functions) that  
I need to run on 70 data sets (each consisting of a pair of files).

I wish to run these data sets in a computer cluster that is run by my  
uni (HOWEVER they cannot help me with this problem but say it is  
do-able)

the cluster is clever enough that if i set my data up as follows:  
within one folder called 'work' there is 70 subfolders each of which  
contain a pair of files, each pair of files having a unique first part  
eg CottonEA05 as in the example text below)

then if I have one R script to run the analysis within the main  
folder, it will open each subfolder, run the R script and output the  
results into that subfolder.

The problem is that this script for R needs to have some kind of wild  
card element so for example in the script below, R will replace  
CottonEA05 with the whatever the unique identifier is for the  
particular subfolder its looking through eg change it to   
Martin_M_STAGE.txt or bananas_M_STAGE.txt etc

Can R do this? ie can it look a file title, and change the file name  
within the script to be the same as that file title, and then run the  
analysis

OR do I have to use another programme that does that?

###
m<-read.table("CottonEA05_M_STAGE.txt")
#"CottonEA05" what is different for each dataset


M<-as.matrix(m[,-c(1)])
rownames(M)<-(m[,1])
pa<-read.table("CottonEA05_D_STAGE.txt",header=T)
timetable<-read.table("TimeBinLookup.txt",header=T,sep="\t")
PA<-as.matrix(pa[,-c(1)])
rownames(PA)<-(pa[,1])
OCHAR<-c()

source("DISPARITY.R")
library(calibrate)
###


Thanks
Martin

-- 
Martin Hughes
MPhil/PhD Research in Biology
Rm 1.07,  4south
University of Bath
Department of Biology and Biochemistry
Claverton
Bath    BA2 7AY
Tel: 01225 385 437
M.Hughes at bath.ac.uk
http://www.bath.ac.uk/bio-sci/biodiversity-lab/hughes.html



More information about the R-help mailing list