[R] Creating a minimal package (was: where does R search when source()?)

Gabor Grothendieck ggrothendieck at myway.com
Sun Jul 11 07:40:33 CEST 2004


Roger,

A list of the steps referred to below would be of interest.
I realize the extensions manual exists but what I was
thinking of was just a list of the minimal steps you take
when you create a package for yourself.

Thanks.


Roger D. Peng <rpeng <at> jhsph.edu> writes:

: 
: In fact, there is an elegant solution, and that is to write a 
: package.  If this is all for personal use, then writing a package 
: can be as simple as creating a few directories, copying the 
: script files, and then running R CMD INSTALL.  I do this all the 
: time when I have multiple projects that use the same code.
: 
: -roger
: 
: Shin, Daehyok wrote:
: > To my knowledge, it is a common practice for users to archive some script
: > files in other directories than current working directory, when the script
: > files are frequently used in many cases. So, it is somewhat surprising to 
me
: > there is no elegant solution to set up default search paths in R.
: > 
: > Here is my suggestion.
: > According to the setup of Python (http://docs.python.org/tut/node8.html),
: > when source() is called,
: > 
: > 1. Search current working directory.
: > 2. If not found, search the directories specified by the environment
: > variable RPATH.
: > 
: > I think this change will help users to manage script files more easily. 
What
: > do you think of it?
: > 
: > Daehyok Shin
: > 
: > 
: >>-----Original Message-----
: >>From: Liaw, Andy [mailto:andy_liaw <at> merck.com]
: >>Sent: Saturday, July 10, 2004 PM 10:07
: >>To: 'sdhyok <at> email.unc.edu'; R, Help
: >>Subject: RE: [R] where does R search when source()?
: >>
: >>
: >>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.
: >>>>------------------------------------------------------------------
: >>>>------------
: >>>>
: >>>
: >>>
: >>>
: >>
: >>------------------------------------------------------------------
: >>------------
: >>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 <at> 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
: >
: 
: ______________________________________________
: R-help <at> 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
: 
:




More information about the R-help mailing list