[R] [newbie] storage/use of user's own functions?

Joshua Wiley jwiley.psych at gmail.com
Mon Feb 6 05:06:58 CET 2012


Hi Tom,

I don't believe there is a standard location.  You can set variables or have functions run (say to source other functions in) in your .Rprofile file.  That way, you always have them.  Once you get more than a handful of functions, it is probably time to consider putting them into your own package.  This allows you to document them etc. then accessing them is as easy as loading your package.  Also makes checking and distributing to others easier of that ever comes up.

Hope this helps,

Josh

On Feb 5, 2012, at 19:48, Tom Roche <Tom_Roche at pobox.com> wrote:

> 
> I'm new but am already starting to accumulate utility functions for
> the fairly specialized kinds of data files with which I work. I'd like
> to keep those functions in a single folder, or filetree rooted at a
> specific folder under my $HOME (I'm running linux), for ease of
> 
> * source()-ing
> * git commit to bitbucket
> * scp to clusters
> 
> I'm wondering,
> 
> 1 is there a canonical location for personal functions, notably on
>  linuxen?
> 
> 2 how can one make that location most easily available? or must one
>  always provide either a relative path from one's R cwd, or an FQ
>  path to, the personal-functions folder?
> 
> Apologies if this is a FAQ, but I didn't see anything about it @
> 
> http://cran.r-project.org/doc/FAQ/R-FAQ.html
> http://cran.r-project.org/doc/manuals/R-admin.html
> 
> or in casual rseek-ing.
> 
> TIA, Tom Roche <Tom_Roche at pobox.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.



More information about the R-help mailing list