[R] Calling R from R and specifying "wait until script is finished"

Sean Davis sdavis2 at mail.nih.gov
Sun May 22 03:09:10 CEST 2005


----- Original Message ----- 
From: "Lapointe, Pierre" <Pierre.Lapointe at nbf.ca>
To: <r-help at stat.math.ethz.ch>
Sent: Saturday, May 21, 2005 8:51 PM
Subject: [R] Calling R from R and specifying "wait until script is finished"


> Hello,
>
> Let's say I have 50 R scripts to run.  What would be the most efficient 
> way
> to run them?

> Is there an easier way?  Something like calling R from R and specifying 
> that
> the script has to be finished before continuing.

How about something like (untested):

for (i in 1:50) {
  filename <- paste('/path/to/files/',i,'.txt',sep="")
  source(filename)
}

As an alternative, if you know the filenames and have them in an R vector 
called filenames, you could do:

for (i in filenames) {
  source(i)
}

Sean




More information about the R-help mailing list