[R] packagename:::functionname vs. importFrom
Peter Langfelder
peter.langfelder at gmail.com
Tue Jan 4 01:56:53 CET 2011
Well, I'm pretty sure that, inside package A, calling B::functionName
will not work if B has not been imported. That's why I use ::: (after
spending some time trying to figure out why :: didn't work). At least
that was the state of affairs as of R 2.9 or so, perhaps things have
changed since then.
Peter
On Mon, Jan 3, 2011 at 4:48 PM, Hadley Wickham <hadley at rice.edu> wrote:
>>> I think you mean packagename::functionname? The three colon form is
>>> for accessing non-exported objects.
>>
>> Normally two colons suffice, but within a package you need three to
>> access exported but un-imported objects :)
>
> Are you sure?
>
> Note that it is typically a design mistake to use ‘:::’ in your
> code since the corresponding object has probably been kept
> internal for a good reason. Consider contacting the package
> maintainer if you feel the need to access the object for anything
> but mere inspection.
>
> Hadley
>
> --
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/
>
More information about the R-help
mailing list