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

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Sun 11 Jul 2004 - 12:07:05 EST


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.
> > ------------------------------------------------------------------
> > ------------
> >
>
>
>



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Jul 11 12:15:51 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 02:35:30 EST