[R] BATCH processing in R

About this list Date view Thread view Subject view Author view

Laura Drake (ladrake@ece.nwu.edu)
Wed, 01 Sep 1999 08:18:54 -0500



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@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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b3 on Tue 04 Jan 2000 - 13:33:57 EST