[R] How to save independent R sessions in BATCH mode?

Sarah Goslee sarah.goslee at gmail.com
Sat Apr 11 20:44:09 CEST 2009


You need to delete all the files initially loaded in data1.Rdata using rm()
eg rm(list=ls(pat=".*"))

Sarah

On Sat, Apr 11, 2009 at 1:35 PM,  <mcnda839 at mncn.csic.es> wrote:
> Hi Rers,
>
> I would like to use the BATCH mode to R automatically:
> open 2 R sessions (ex. data1.Rdata, data2.Rdata),
> produce some calculations (…),
> save 2 sessions (sol1.Rdata, sol2.Rdata),
>
> My problem when using R CMD BATCH master.R is that when I use master.R as a
> master file, with:
>  source(“file1.R”)
>  source(“file2.R”)
>
> with “file1.R” script:
>  load(“data1.Rdata”)
>  …
>  save.image(“sol1.Rdata”)
>
> and “file2.R” script with
>  load(“data2.Rdata”)
>  …
>  save.image(“sol2.Rdata”)
>
> sol.2.Rdata comes with information of sol1.Rdata, appearing that the 1st R
> session did not shutdown.
> Any suggestions to save sol1.Rdata and sol2.Rdata, independently from each
> other?
>
> Grateful in advance,
> All the best,
>
> Diogo Alagador
>

-- 
Sarah Goslee
http://www.functionaldiversity.org




More information about the R-help mailing list