Skip to content
Prev 44888 / 63424 Next

Declaring/importing non-exported functions [car] in another package

On 1/16/2013 11:40 AM, Duncan Murdoch wrote:
Hmm.  It turns out that this is a bit more complicated, since 
car::df.terms is an S3 generic,
relying on car:::df.terms.default().

In my function, I am now using car::: explicitly--

     # determine "size" of intervals [perhaps need importFrom(car, 
car:::df.terms, ...) in NAMESPACE?]
     if(is.null(df)) {
       df <- if (Scheffe) sum(car:::df.terms(object)) else 2
   }

However, when I removed the definitions of the subsidiary 
df.terms.default from my package, R CMD check
complains bitterly:

 > coefplot(mod, add=TRUE, Scheffe=TRUE, fill=TRUE)
Error in UseMethod("df.terms") :
   no applicable method for 'df.terms' applied to an object of class 
"c('mlm', 'lm')"
Calls: coefplot -> coefplot.mlm -> <Anonymous>
Execution halted

So, the semantics of importFrom() do not allow non-exported functions (I 
still wonder why), and my only direct option is to
copy these functions to my package.

-Michael