[R] Writing R packages in an easier way?

David Scott d.scott at auckland.ac.nz
Sat Feb 12 04:06:22 CET 2011


On 12/02/2011 1:27 p.m., Yihui Xie wrote:
> I guess Emacs + ESS + roxygen might be the easiest way to write an R
> package. Writing or modifying Rd files/templates, in my eyes, is
> really time-consuming and the Rd files are difficult to maintain
> (unless you really have a good memory). I became reluctant to maintain
> my R packages simply because I felt painful to maintain the
> documentation. After I learned a bit about roxygen and ESS a few
> months ago, several of my packages came back to life again (e.g. this
> picture is a piece of evidence:
> https://github.com/yihui/animation/graphs/impact). The feeling was
> probably like when Dr Harrell switched from SAS to S (see
> library(fortunes); fortune('I quit using SAS')).
>
> Anyway, prompt() and package.skeleton() are very helpful in the short run.
>
> Regards,
> Yihui
> --

There is also the slackers way of producing R packages without writing 
any documentation.

You create a file PackageName-internal.Rd in which you then put the name 
of the package and all the functions as aliases:

\name{PackageName-internal}
\alias{function1}
\alias{function2}
.
.
.

\title{Internal PackageName objects}
\description{Internal PackageName objects.}
\details{These are not to be called by the user.}
\keyword{internal}


I only mention this possibility for the sake of intellectual 
completeness of the discussion of this topic.

It of course totally subverts the whole philosophy of package 
construction in R, so I wouldn't dream of using it myself.

David Scott

-- 
_________________________________________________________________
David Scott	Department of Statistics
		The University of Auckland, PB 92019
		Auckland 1142,    NEW ZEALAND
Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
Email:	d.scott at auckland.ac.nz,  Fax: +64 9 373 7018

Director of Consulting, Department of Statistics



More information about the R-help mailing list