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

Shin, Daehyok sdhyok at email.unc.edu
Sun Jul 11 19:16:40 CEST 2004


> >Considering replies to my question, typical practices of R users seem:
> >1. Creating a special function to source frequently used scripts.
>
> That's not right.  The practice I was describing is to have frequently
> used code in a function, not in a script.

Here, I meant "scripts " is "script files" whether they contains a series of
commands, or reusable functions.
This practice is not based on other replies, not yours.

>
> >2. Creating a personal package containing frequently used scripts.
>
> And here it would be frequently used *functions*.
> >

If the script files is a collection of functions, as you said, creating a
package can be one solution.

> >Both of them needs additional steps to edit the function or to
> >create/install the package
> >when a script file is edited or added.
>
> There's no additional step.  You write the function and use it.

Why are there no additional steps?
You suggested creating and installing a package is the solution to source
frequently used functions.
Then, every time I add/modify a function in a script file, or add new script
file, I have to re-create and re-install the package,
which are additional steps, not directly related with the addition or
modification.

More fundamental problem here is that the functions may have no common
context except "frequently used".
In the case, bundling all the functions into one package may not be a proper
choice.

So, I still think creating new package mayb be too heavy solution.
Why don't we simply extend a little bit the searching range of source
function?

>
> Duncan Murdoch
>
> ______________________________________________
> 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