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

Michael Dewey info at aghmed.fsnet.co.uk
Mon Feb 6 18:51:41 CET 2012


At 04:06 06/02/2012, Joshua Wiley wrote:
>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.

May I endorse Josh's suggestion to consider writing your own package 
to include them. I put off doing this for too long. There is a bit of 
learning to do first but the investment will repay itself. You need 
the extensions manual, at least the early chapters.


>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.

Michael Dewey
info at aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html



More information about the R-help mailing list