From ggrothendieck at gmail.com  Tue Aug 23 05:19:28 2005
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Mon, 22 Aug 2005 23:19:28 -0400
Subject: [Rd] Functions with the same name: best practices
In-Reply-To: <f8e6ff05050822195854575b4d@mail.gmail.com>
References: <f8e6ff05050822195854575b4d@mail.gmail.com>
Message-ID: <971536df05082220191600ac8@mail.gmail.com>

On 8/22/05, hadley wickham <h.wickham at gmail.com> wrote:
> Ok, here's another best practices question - let's say I'm writing a
> package and I want to use a function name that is already claimed by a
> function in the base R packages.  For the sake of argument, let's
> pretend this function is for profiling the performance of a function
> (like Rprof for example), and so an obvious name that comes to mind is
> profile.  This, of course, clashes with the built in profile for
> "investigating behavior of objective function near the solution
> represented by fitted."
> 
> A little thinking and a quick survey of other packages reveal some
> possible solutions:
> 
>  * capitalise the function differently (eg. Profile)
>  * use a prefix/suffic (eg. Rprof)
>  * use a thesaurus
>  * use namespaces (and rely on others to use namespaces correctly in
> their code/packages)
> 
> What would you suggest?
> 

profile is a generic so if your function has the same purpose but for a 
different class you can just create a new method.



[Rd] Functions with the same name: best practices
Gabor Grothendieck