[R] how to load functions from file

Bert Gunter gunter.berton at gene.com
Wed Apr 4 12:32:14 CEST 2012


Rolf:

Google on "load functions into R."
A post referencing source() (from Henrik Bengtsson is the first hit.

-- Bert

On Wed, Apr 4, 2012 at 3:23 AM, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list