Dear Douglas,
I'm not quite sure about that, but you could do something like:

1. Save for function in txt format
2. Use source() to load it into R

As a toy example, suppose you have function called "myfunction" which is
defined as:

myfunction=funciton(x,y) x^y

Now, suppose you save "myfunction" in a text file in "C:/temp/functions",
with the same name ("myfunction.txt"). To load and use "myfunction" in R,
you type:

source("C:/temp/functions/myfunction.txt")
myfunction(2,3)

which result, of course, would be 8.

Another option is to save your function in the file "..\etc\Rprofile.site"
as Xiaoxu LI suggested before.

HTH,

Jorge


On Thu, Oct 30, 2008 at 1:45 PM, Douglas M. Hultstrand <[EMAIL PROTECTED]
> wrote:

> Hello all,
>
> I am fairly new to R and I have created a function that I use quit
> frequently.  I was wondering if there is away to save this function in an
> existing library so I can call it by using the function name once the
> library is loaded?
>
> Thanks,
> Doug
>
> --
> ---------------------------------
> Douglas M. Hultstrand, MS
> Senior Hydrometeorologist
> Metstat, Inc. Windsor, Colorado
> voice: 970.686.1253
> email: [EMAIL PROTECTED]
> web: http://www.metstat.com
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to