From ripley at stats.ox.ac.uk  Wed Mar 28 09:00:16 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 28 Mar 2007 08:00:16 +0100 (BST)
Subject: [Rd] accessing "hidden" functions
In-Reply-To: <5CA14556-E1F2-4B9D-A1EE-59818DA67FB9@jhsph.edu>
References: <5CA14556-E1F2-4B9D-A1EE-59818DA67FB9@jhsph.edu>
Message-ID: <Pine.LNX.4.64.0703280758160.2363@gannet.stats.ox.ac.uk>

On Wed, 28 Mar 2007, Benilton Carvalho wrote:

> Hi,
>
> (I tried looking for it, but I don't think it was discussed before...
> or maybe I didn't use the correct keywords).
>
> I have a package (say, pkg1), which uses NAMESPACE. This package
> contains a bunch of functions the are used internally, therefore
> they're not exported (say, internalFunc1).
>
> Even though internalFunc1 is not exported, I can access it externally
> using pkg1:::internalFunc1 (yes, I do understand this is not supposed
> to be done).
>
> Okay... now I have a second internal function, which starts with a
> dot (eg, ".internalFunc2").
>
> Is there a way of accessing it without exporting it (or exposing it
> by removing the "dot")? ie, something like pkg1:::.internalFunc2 ?

Yes.  Starting a name with a dot is merely a convention, and almost 
everything (including the ::: operator) treats all names the same.

You will see lots of examples in the tools package used by R CMD check.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] accessing "hidden" functions
Prof Brian Ripley