[R] path for source()
Vladimir Eremeev
wl2776 at gmail.com
Thu Feb 8 09:45:51 CET 2007
Here is the discussion about the function search.path()
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/34411.html
which searches the PATH variable for your script and returns the full path.
You also can put your script contents in functions, then create a package
and load it with library().
package.skeleton() can help you.
Anyway, source()'ing every time does not seem to be a good idea, because
every time you do this you obtain one more copy of your functions and
variables in the newly created workspace.
If you don't want to create a package, you can save your functions in a file
with the .Rdata extension and attach that file.
Try going here
https://www.stat.math.ethz.ch/pipermail/r-help/2004-July/thread.html and
searching "source()" in the page (i.e. in message headers). I believe,
discussions could provide you with several more good ideas.
colliera wrote:
>
> i have a couple of .R files distributed about my file system. i commonly
> source() these from other files, but i have to include the full file path.
> this is not always convenient if you move files around. is there a way of
> setting the search path for source()?
>
--
View this message in context: http://www.nabble.com/-R--path-for-source%28%29-tf3191709.html#a8861457
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list