[R] how to run a script at the beginning of an interacive session ?

Mike R mike.rstat at gmail.com
Wed Jun 8 20:32:33 CEST 2005

On 6/8/05, Marc Schwartz <MSchwartz at mn.rr.com> wrote:

Thanks Marc,

Cool ideas, thanks!  Building on them, here is a twist. 

With this line in .Rprofile:

  .First <- function() {if(Sys.getenv("R_PROJECT")!="")

R can be run with this bash command line:

##  export R_PROJECT=project_A.R;  R; unset R_PROJECT

Alternatively, R could be run with this bash command line:

##  wrapR project_4.R

---- contents of wrapR ----
#! /bin/bash
export R_PROJECT=$1
---- end ----

What do you think? 

Thanks in advance,

More information about the R-help mailing list