[R] packagename:::functionname vs. importFrom

luke-tierney at uiowa.edu luke-tierney at uiowa.edu
Tue Jan 4 22:14:39 CET 2011


On Tue, 4 Jan 2011, Frank Harrell wrote:

>
> Thanks Luke.  By "the namespace from which you import is loaded when your
> package is" I take it that you are saying that all such referenced packages
> are loaded up front, which is not what I hoped.

That is what happens. You can use conditional imports in the NAMESPACE
but that isn't appropriate for all setting.  Using :: is reasonable if
you want to use a fuction only if its package is available.  Using :::
is code is a really bad idea for reasons already explained inthis
thread.

>  And it's too bad you can't
> import unexported objects, as that rather defeats the purpose of importFrom.

The purpose of importFrom is to avoid a full import.  So in no sense
does this "defeat the purpose of importFrom".

Best,

luke

>
> Frank
>
>
> -----
> Frank Harrell
> Department of Biostatistics, Vanderbilt University
>

-- 
Luke Tierney
Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



More information about the R-help mailing list