Re: [R] Creating a minimal package
Duncan Murdoch wrote: On Mon, 12 Jul 2004 15:14:27 +0200, Uwe Ligges <[EMAIL PROTECTED]> wrote : Gabor Grothendieck wrote: The objective should be that creating a package is as easy as this: f <- function()1; g <- function()2; d <- 3; e <- 4:5 package.skeleton(list=c("f","g","d","e"), name="AnExample") library(AnExample) f() which means that the package needs to be inserted where library will find it. It should not be necessary to have an understanding of this. OK, I understand what you are going to do, but in that case you can use dump() into an *.R or save() into an *.RData file and use source()/load() to load it again. I don't see any advantage of a package if you don't want to modify documentation or other stuff in the package. Also, you would need the tools to make a binary package from the source package somewhere. package.skeleton() is clearly not intended to be used for that purpose, but to create the template for your source package. Hence the default should not be changed. I agree with both of you on this. Currently the method that Uwe describes is a lot easier than creating a package, but I think the objective should be to make things almost as easy as Gabor describes. Not completely as easy: he's missing the step where the package is installed. I think we want to keep that (because the distinction between the source of a package and the installed copy of it is important), but it should be easier to install a new package than it is now, especially in Windows. So I'm suggesting that it would be nice to be able to do something like this: f <- function()1; g <- function()2; d <- 3; e <- 4:5 package.skeleton(list=c("f","g","d","e"), name="AnExample") install.packages("AnExample", build = TRUE) library(AnExample) f() but currently install.packages doesn't know how to build, and for most Windows users, a fairly substantial effort is necessary to obtain all the tools. Duncan Murdoch I haven't checked on the installation tools under Windows but I think that most, if not all, of the creation and installation of a binary package (i.e. building indices, etc.) could be done in R for packages that do not require compilation of source code and provided that you are willing to go without some forms of the man pages. __ [EMAIL PROTECTED] 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
Re: [R] Creating a minimal package (was: where does R search when source()?)
On Mon, 12 Jul 2004 09:24:43 -0400, Duncan Murdoch <[EMAIL PROTECTED]> wrote: >These changes are available in r-patched. I'll do a binary build >today, and they should be downloadable from CRAN tomorrow. Oops, I did the build but forgot the upload. Make that "available on Wednesday". Duncan Murdoch __ [EMAIL PROTECTED] 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
Re: [R] Creating a minimal package
Folks: Without entering the debate, just a little addendum to Andy's suggestions and Duncan's and Gabor's comments about the difficulty of building (simple, containing no binaries and just a few functions) packages for R. I have for some time now built such R-code only .rda files. It is a trivial matter to automatically attach them at startup (through .Rprofile, .First, or other startup options) so that they are then "transparently" available for use. I have also found it to be a simple matter to bundle such customized bunches of functions for "naive" users into a little UI so that they click on a desktop icon and R opens with the necessary functions and data (and maybe even prompts them, etc.). You could get quite fancy with this with TK-type stuff, but I haven't found it necessary to do this. Please note: I know this is only for small stuff, risks clashes because the function names are global variables, is not for general distribution, etc. However, in the "Pareto Principle" spirit or doing things simply when that suffices, I have found such quick and dirty approaches quite useful. Why bang your head on a wall if you don't need to? Cheers, Bert "Liaw, Andy" wrote: > BTW, for functions/objects that you would like to use over and over, but do > not want to go through the hurdle of packaging, there's a fairly simple way > to achieve similar effect: save all of them in a .rda file, and when you > need them, just attach() the .rda file. > > Andy > > __ > [EMAIL PROTECTED] 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 -- Bert Gunter Non-Clinical Biostatistics Genentech MS: 240B Phone: 650-467-7374 "The business of the statistician is to catalyze the scientific learning process." -- George E.P. Box __ [EMAIL PROTECTED] 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
Re: [R] Creating a minimal package
On Mon, 12 Jul 2004 15:14:27 +0200, Uwe Ligges <[EMAIL PROTECTED]> wrote : >Gabor Grothendieck wrote: >> The objective should be that creating a package is as easy as this: >> >>f <- function()1; g <- function()2; d <- 3; e <- 4:5 >>package.skeleton(list=c("f","g","d","e"), name="AnExample") >>library(AnExample) >>f() >> >> which means that the package needs to be inserted where library will >> find it. It should not be necessary to have an understanding of this. >> > >OK, I understand what you are going to do, but in that case you can use >dump() into an *.R or save() into an *.RData file and use >source()/load() to load it again. I don't see any advantage of a package >if you don't want to modify documentation or other stuff in the package. >Also, you would need the tools to make a binary package from the source >package somewhere. package.skeleton() is clearly not intended to be used >for that purpose, but to create the template for your source package. >Hence the default should not be changed. I agree with both of you on this. Currently the method that Uwe describes is a lot easier than creating a package, but I think the objective should be to make things almost as easy as Gabor describes. Not completely as easy: he's missing the step where the package is installed. I think we want to keep that (because the distinction between the source of a package and the installed copy of it is important), but it should be easier to install a new package than it is now, especially in Windows. So I'm suggesting that it would be nice to be able to do something like this: f <- function()1; g <- function()2; d <- 3; e <- 4:5 package.skeleton(list=c("f","g","d","e"), name="AnExample") install.packages("AnExample", build = TRUE) library(AnExample) f() but currently install.packages doesn't know how to build, and for most Windows users, a fairly substantial effort is necessary to obtain all the tools. Duncan Murdoch __ [EMAIL PROTECTED] 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
Re: [R] Creating a minimal package (was: where does R search when source()?)
On Mon, 12 Jul 2004 04:32:55 + (UTC), Gabor Grothendieck <[EMAIL PROTECTED]> wrote : >Duncan Murdoch pair.com> writes: > >: On Sun, 11 Jul 2004 21:28:44 + (UTC), Gabor Grothendieck >: myway.com> wrote: >: > >: >1. when I run skeleton.package realize that I must use the arg >: > path = "library" >: > The example that is shown there appears to omit that. >: >: The default is to put it in the current directory. The assumption is >: that you started R where you want to work, or have switched to that >: directory later. This is usually true for Unix users, but generally >: not for Windows users. >: >: I'm not sure what sort of change to make here. path = "library" >: (literally) won't usually work, because it won't try to create the >: directory. Suggestion? > >Perhaps we could use: > > path = .libPaths()[[1]] > >as the default value of path in package.skeleton. I've now fixed the DESCRIPTION file generation so it sets the package name. I didn't change the path default, but I changed the example (on Windows) to set the working directory to the user's home directory, and added a bit of text explaining what else is necessary to make use of the new package. When I test it now, the example produces a package that installs and runs properly (though you do get warnings in the build because of various things that need to be manually edited in the man pages). These changes are available in r-patched. I'll do a binary build today, and they should be downloadable from CRAN tomorrow. Thanks for your suggestions. BTW, the new R Newsletter describes a facility for working with packages; I haven't tried it out yet, but it looks like it would be useful. Duncan Murdoch __ [EMAIL PROTECTED] 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
RE: [R] Creating a minimal package
> From: Gabor Grothendieck > [snip] > > The objective should be that creating a package is as easy as this: > >f <- function()1; g <- function()2; d <- 3; e <- 4:5 >package.skeleton(list=c("f","g","d","e"), name="AnExample") >library(AnExample) >f() > > which means that the package needs to be inserted where library will > find it. It should not be necessary to have an understanding of this. To the best of my knowledge (which is not saying much, admittedly) no version of R on any OS would that work. package.skeleton() only create the directory tree and populate it with code and template files. You still need to package it up from a shell with R CMD build AnExample (or R CMD build --binary AnExample for Windows, and maybe Mac?). Then you need the install.package("AnExample", CRAN=NULL), before you can actually do library(AnExample). BTW, for functions/objects that you would like to use over and over, but do not want to go through the hurdle of packaging, there's a fairly simple way to achieve similar effect: save all of them in a .rda file, and when you need them, just attach() the .rda file. Let me bring up the old phrase: R is Open Source. If you want something bad enough, you can try to make it happen yourself. A good example is the scripting patch announced on R-devel by Neil McKay. Neil had provided patches to various versions of R for a while. If the packaging situation bothers you enough, feel free to contribute. I'm quite sure DM will be happy to get help... Andy __ [EMAIL PROTECTED] 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
Re: [R] Creating a minimal package
Gabor Grothendieck wrote: Uwe Ligges statistik.uni-dortmund.de> writes: : : Gabor Grothendieck wrote: : : > Duncan Murdoch pair.com> writes: : > : > : On Sun, 11 Jul 2004 21:28:44 + (UTC), Gabor Grothendieck : > : myway.com> wrote: : > : : > : > : >1. when I run skeleton.package realize that I must use the arg : > : > path = "library" : > : > The example that is shown there appears to omit that. : > : : > : The default is to put it in the current directory. The assumption is : > : that you started R where you want to work, or have switched to that : > : directory later. This is usually true for Unix users, but generally : > : not for Windows users. : > : : > : I'm not sure what sort of change to make here. path = "library" : > : (literally) won't usually work, because it won't try to create the : > : directory. Suggestion? : > : > Perhaps we could use: : > : >path = .libPaths()[[1]] : > : > as the default value of path in package.skeleton. : : Actually, that's a bad idea, because you don't want a source package in : your binary library tree. : I'm really happy with the default and the documentation which tells us : about the "path" argument. Most (all?) functions I know do write to the : current working directory. You do not want another default for : write.table() et al. to write the data to, do you? The objective should be that creating a package is as easy as this: f <- function()1; g <- function()2; d <- 3; e <- 4:5 package.skeleton(list=c("f","g","d","e"), name="AnExample") library(AnExample) f() which means that the package needs to be inserted where library will find it. It should not be necessary to have an understanding of this. OK, I understand what you are going to do, but in that case you can use dump() into an *.R or save() into an *.RData file and use source()/load() to load it again. I don't see any advantage of a package if you don't want to modify documentation or other stuff in the package. Also, you would need the tools to make a binary package from the source package somewhere. package.skeleton() is clearly not intended to be used for that purpose, but to create the template for your source package. Hence the default should not be changed. Uwe Ligges __ [EMAIL PROTECTED] 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
Re: [R] Creating a minimal package
Uwe Ligges statistik.uni-dortmund.de> writes: : : Gabor Grothendieck wrote: : : > Duncan Murdoch pair.com> writes: : > : > : On Sun, 11 Jul 2004 21:28:44 + (UTC), Gabor Grothendieck : > : myway.com> wrote: : > : : > : > : >1. when I run skeleton.package realize that I must use the arg : > : > path = "library" : > : > The example that is shown there appears to omit that. : > : : > : The default is to put it in the current directory. The assumption is : > : that you started R where you want to work, or have switched to that : > : directory later. This is usually true for Unix users, but generally : > : not for Windows users. : > : : > : I'm not sure what sort of change to make here. path = "library" : > : (literally) won't usually work, because it won't try to create the : > : directory. Suggestion? : > : > Perhaps we could use: : > : >path = .libPaths()[[1]] : > : > as the default value of path in package.skeleton. : : Actually, that's a bad idea, because you don't want a source package in : your binary library tree. : I'm really happy with the default and the documentation which tells us : about the "path" argument. Most (all?) functions I know do write to the : current working directory. You do not want another default for : write.table() et al. to write the data to, do you? The objective should be that creating a package is as easy as this: f <- function()1; g <- function()2; d <- 3; e <- 4:5 package.skeleton(list=c("f","g","d","e"), name="AnExample") library(AnExample) f() which means that the package needs to be inserted where library will find it. It should not be necessary to have an understanding of this. __ [EMAIL PROTECTED] 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
Re: [R] Creating a minimal package
Gabor Grothendieck wrote: Duncan Murdoch pair.com> writes: : On Sun, 11 Jul 2004 21:28:44 + (UTC), Gabor Grothendieck : myway.com> wrote: : : >1. when I run skeleton.package realize that I must use the arg : > path = "library" : > The example that is shown there appears to omit that. : : The default is to put it in the current directory. The assumption is : that you started R where you want to work, or have switched to that : directory later. This is usually true for Unix users, but generally : not for Windows users. : : I'm not sure what sort of change to make here. path = "library" : (literally) won't usually work, because it won't try to create the : directory. Suggestion? Perhaps we could use: path = .libPaths()[[1]] as the default value of path in package.skeleton. Actually, that's a bad idea, because you don't want a source package in your binary library tree. I'm really happy with the default and the documentation which tells us about the "path" argument. Most (all?) functions I know do write to the current working directory. You do not want another default for write.table() et al. to write the data to, do you? Uwe Ligges __ [EMAIL PROTECTED] 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 __ [EMAIL PROTECTED] 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
Re: [R] Creating a minimal package (was: where does R search when source()?)
Duncan Murdoch pair.com> writes: : On Sun, 11 Jul 2004 21:28:44 + (UTC), Gabor Grothendieck : myway.com> wrote: : : >1. when I run skeleton.package realize that I must use the arg : > path = "library" : > The example that is shown there appears to omit that. : : The default is to put it in the current directory. The assumption is : that you started R where you want to work, or have switched to that : directory later. This is usually true for Unix users, but generally : not for Windows users. : : I'm not sure what sort of change to make here. path = "library" : (literally) won't usually work, because it won't try to create the : directory. Suggestion? Perhaps we could use: path = .libPaths()[[1]] as the default value of path in package.skeleton. __ [EMAIL PROTECTED] 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
Re: [R] Creating a minimal package (was: where does R search when source()?)
Thanks for the information. It *should* be that simple; thanks for pointing out ways in which it is not. Some more specific comments below... On Sun, 11 Jul 2004 21:28:44 + (UTC), Gabor Grothendieck <[EMAIL PROTECTED]> wrote: >Duncan Murdoch pair.com> writes: > >: >: On Sun, 11 Jul 2004 05:40:33 + (UTC), Gabor Grothendieck >: myway.com> wrote: >: >: >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. >: >: There's really just one step: call package.skeleton(). >: >: Duncan Murdoch > >I was hoping for something that really was that simple but >I tried and so far it seems that I also must also > >1. when I run skeleton.package realize that I must use the arg > path = "library" > The example that is shown there appears to omit that. The default is to put it in the current directory. The assumption is that you started R where you want to work, or have switched to that directory later. This is usually true for Unix users, but generally not for Windows users. I'm not sure what sort of change to make here. path = "library" (literally) won't usually work, because it won't try to create the directory. Suggestion? >2. download and install tools.zip, perl and windows help as listed at: > > http://www.murdoch-sutherland.com/Rtools/ > >I got tripped up for quite a while when it could not find hhc.exe and >I finally realized I had not downloaded the windows help distribution. Something I've meant to do for a long time (and got started on, once) is to write a program that checks your system for the package building requirements. Just run it, and it'll tell you what it thinks is missing (and how to find it). >3. change the name of the package in the DESCRIPTION file -- it seems >that the name = arg on package.skeleton did not change it for me. Sounds like an oversight to me, but very easy to fix. >4. make changes to the documentation files. I am just working on this >now. Some default null documentation exists but it appears that it >MUST be modified in order to get a working package so this makes another >step. Should also be pretty easy to fix... > >There maybe other things but its taken me several hours just to get >this far and I do not yet have a functioning package. > >I think it would be handy if everything you need to know to actually >create a minimal functioning package were in ?skeleton.package >so that one could create a minimal functioning package without actually >reading the extensions manual and then incrementally improve it. Right >now there is quite a bit you have to know just to get to that point. That's a good point. I think we're moving towards a point where Perl won't be necessary; the other tools are mostly reasonably small, and I think we could set things up so that the install process worked with or without HHC. >I have so far looked at skeleton.package, readme.packages in rw1091, >murdoch-suthertherland.com link mentioned above and the extensions manual >so the startup to doing this is really a multi-step complex process. >The skeleton.package idea actually seems quite nifty but I think it >needs more work before one can really claim that its a one-step process >to create the example package. __ [EMAIL PROTECTED] 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
Re: [R] Creating a minimal package (was: where does R search when source()?)
Duncan Murdoch pair.com> writes: : : On Sun, 11 Jul 2004 05:40:33 + (UTC), Gabor Grothendieck : myway.com> wrote: : : >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. : : There's really just one step: call package.skeleton(). : : Duncan Murdoch I was hoping for something that really was that simple but I tried and so far it seems that I also must also 1. when I run skeleton.package realize that I must use the arg path = "library" The example that is shown there appears to omit that. 2. download and install tools.zip, perl and windows help as listed at: http://www.murdoch-sutherland.com/Rtools/ I got tripped up for quite a while when it could not find hhc.exe and I finally realized I had not downloaded the windows help distribution. 3. change the name of the package in the DESCRIPTION file -- it seems that the name = arg on package.skeleton did not change it for me. 4. make changes to the documentation files. I am just working on this now. Some default null documentation exists but it appears that it MUST be modified in order to get a working package so this makes another step. There maybe other things but its taken me several hours just to get this far and I do not yet have a functioning package. I think it would be handy if everything you need to know to actually create a minimal functioning package were in ?skeleton.package so that one could create a minimal functioning package without actually reading the extensions manual and then incrementally improve it. Right now there is quite a bit you have to know just to get to that point. I have so far looked at skeleton.package, readme.packages in rw1091, murdoch-suthertherland.com link mentioned above and the extensions manual so the startup to doing this is really a multi-step complex process. The skeleton.package idea actually seems quite nifty but I think it needs more work before one can really claim that its a one-step process to create the example package. __ [EMAIL PROTECTED] 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
Re: [R] Creating a minimal package
Gabor Grothendieck wrote: 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. It has already been automated. See ?package.skeleton Roger D. Peng 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 merck.com] : >>Sent: Saturday, July 10, 2004 PM 10:07 : >>To: 'sdhyok 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 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 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 : : __ [EMAIL PROTECTED] 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.h
Re: [R] Creating a minimal package (was: where does R search when source()?)
On Sun, 11 Jul 2004 05:40:33 + (UTC), Gabor Grothendieck <[EMAIL PROTECTED]> wrote: >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. There's really just one step: call package.skeleton(). Duncan Murdoch __ [EMAIL PROTECTED] 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] Creating a minimal package (was: where does R search when source()?)
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 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 merck.com] : >>Sent: Saturday, July 10, 2004 PM 10:07 : >>To: 'sdhyok 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 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 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 : : __ [EMAIL PROTECTED] 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