[R] how to load functions from file
Rolf Turner
rolf.turner at xtra.co.nz
Wed Apr 4 12:23:59 CEST 2012
On 04/04/12 15:54, John Kohr wrote:
> Hello,
>
> I have several functions in an .R file. I try to load them with load() command but it seems is not working..
>
> if .R is in /home/user/myfunctions.R
>
> how can i load it? is there any other way?
Don't assume that you know what "load" means on the basis of
believing that you have an intuitive understanding of this term.
You haven't.
Read the help for load. I.e. RTFM. You will see that the function
load() could scarcely be *less* appropriate for what you are trying
to do.
As someone else had told, the function you need to use is source().
But how would you have found that out, without someone telling you?
Ah! Now you're asking questions!
The simple answer is, damned if I know. I just thrashed around for
a while with help.search() and RSiteSearch(), and looked through
``An Introduction to R'' on the r-project home page. Nada. If you
*know* the function is called "source" then you can find it. If you
don't know .... catch 22.
cheers,
Rolf Turner
More information about the R-help
mailing list