[R] BATCH processing in R

Laura Drake ladrake at ece.nwu.edu
Wed Sep 1 15:18:54 CEST 1999


Dear List,

My question is whether it is possible (and if so, how) to enter values
into R vectors (R_OUTFILE, and R_INFILE in my example below) from the
command line.  In particular, I would like to run R, as a BATCH job,
from a shell script, such as the following:

	while read inputfile_name outputfile_name; do
	  R_OUTFILE=$outputfile_name
	  R_INFILE=$inputfile_name

	  R BATCH infile.R
	done

with, for example, the following infile.R able to use the variables,
R_OUTFILE, and R_INFILE.

	sink(R_OUTFILE)

	x<-read.table(R_INFILE)
	mode(x)="numeric"
	library(cluster)

	a<-agnes(x,T)
	a$order
	a$height

	sink()
	q("no")

I suppose I could write a different infile.R for each pass through the
shell script while-loop, but I don't want to do that if it's avoidable.


Thank You for Any Help You are Able to Provide,

	Laura Drake
	ladrake at ece.nwu.edu
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list