[R] function call from another r file

Suzen, Mehmet msuzen at gmail.com
Sat Nov 24 13:26:37 CET 2012


If you want to handle a generic case, best thing is to create an R
package. It is
much easier to manage that using source(), if you have lots of
different functionality
and data files. Also look at ?system.file.

On Sat, Nov 24, 2012 at 7:49 AM, Jeff Newmiller
<jdnewmil at dcn.davis.ca.us> wrote:
> It is straightforward to load function definitions into memory using the source() function.
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                       Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> sheenmaria <sheenmaria6 at gmail.com> wrote:
>
>>How to call a function from another r file ?
>>Anyone can help me .
>>
>>Having a function named like fun1 which is saved in r file file1.r
>>and i have another r file like file2.r, and  i need to call the fun1
>>(which
>>is in  file1) within file2.
>>
>>Thank you
>>
>>
>>
>>
>>--
>>View this message in context:
>>http://r.789695.n4.nabble.com/function-call-from-another-r-file-tp4650627.html
>>Sent from the R help mailing list archive at Nabble.com.
>>
>>______________________________________________
>>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.
>
> ______________________________________________
> 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.




More information about the R-help mailing list