Skip to content
Back to formatted view

Raw Message

Message-ID: <4EB7E912.6090902@gmail.com>
Date: 2011-11-07T14:20:02Z
From: Duncan Murdoch
Subject: R in batch mode packages loading question
In-Reply-To: <4EB7B7A2.3030209@developpement-durable.gouv.fr>

On 07/11/2011 5:49 AM, PALMIER Patrick (Responsable de groupe) - CETE 
NP/TM/ST wrote:
> Hello,
>
>
> I use R in batch mode. Each time, I execute a script, R is loading each
> packages I need in my script. That's Ok
> But, I had to execute many scripts , and each time R is re-loading the
> corresponding packages, which take to much time
>
> Is it possible ask R to load the packages only once, and stay in memory
> in background for further scripts, which would avoid to load the
> packages in each script, or if you have another solution that need to
> only load packages once in the first scripts, so that further scripts do
> not need to load these packages too.

Write one script that has a sequence of calls to source() to run the 
other scripts.

You'll need to be careful that unintentional leftover objects and 
settings from one script don't affect the others; you may also want to 
use the "echo=TRUE" option when you source, so you see the commands as 
they are executed.

Duncan Murdoch