[R] where does R search when source()?

Liaw, Andy andy_liaw at merck.com
Sun Jul 11 04:07:05 CEST 2004


Not really.  The best I can come up with is something like:

runScript <- function(script, dir="", ...) source(file.path(dir, script,
...) 
scriptdir <- "/path/to/scripts"

runScript(scriptdir, "myScript.R")

Andy

> From: Shin, Daehyok
> 
> The reason I asked is to separate script files from data files.
> Usually, I am working in the directory containing data files, but some
> script files are in other shared directories. In the case, is 
> there any way
> to access the script files conveniently without specifying 
> its absolute
> path? In other word, any way to set up default search paths for script
> files?
> 
> Daehyok Shin (Peter)
> 
> >
> > The former.  No documentation says otherwise, so why would you
> > think that it
> > might search somewhere else?
> >
> > Andy
> >
> >
> > ------------------------------------------------------------------
> > ------------
> > Notice:  This e-mail message, together with any attachments,
> > contains information of Merck & Co., Inc. (One Merck Drive,
> > Whitehouse Station, New Jersey, USA 08889), and/or its affiliates
> > (which may be known outside the United States as Merck Frosst,
> > Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be
> > confidential, proprietary copyrighted and/or legally privileged.
> > It is intended solely for the use of the individual or entity
> > named on this message.  If you are not the intended recipient,
> > and have received this message in error, please notify us
> > immediately by reply e-mail and then delete it from your system.
> > ------------------------------------------------------------------
> > ------------
> >
> 
> 
>




More information about the R-help mailing list