Skip to content

calling self written R functions

4 messages · Joshua Wiley, Sarah Goslee, Sachinthaka Abeywardana

#
Hi Sachin,

Nope, R does not work that way.  You do have several options, though.
For a function or two, consider creating/editing a workspace .Rprofile
file.

https://www.google.com/?q=Rprofile

should bring up a fair number of pages describing this, you might look at a few.

If you find yourself getting a little collection of functions, with
some of them possibly depending on each other, and/or wanting to have
documentation for your function(s), it is time to write a package.
There was a nice video tutorial of this at the LA R User Group meeting
not too long ago, you can find it here:
http://www.youtube.com/watch?v=TER-rQoVs0k
You can also see the official manual on extensions for how to write
packages: http://cran.r-project.org/doc/manuals/R-exts.html

Cheers!

Josh

On Thu, Nov 17, 2011 at 5:26 PM, Sachinthaka Abeywardana
<sachin.abeywardana at gmail.com> wrote:

  
    
#
?source

source("/path/to/foo.R") will load it into R.

Sarah

On Thu, Nov 17, 2011 at 8:26 PM, Sachinthaka Abeywardana
<sachin.abeywardana at gmail.com> wrote: