This is a problem in the lmtest package:
"lrtest.default" is exported as a function rather than declared as an
S3method in its NAMESPACE. I am CCing the maintainer.
For the meantime, you hav to import the default function explicitly, I
believe.
Best,
Uwe Ligges
On 10.01.2012 19:17, Stephanie M. Gogarten wrote:> In my own package, I want to use the default S3 method of the generic
> function lrtest() from the lmtest package. Since I need only one
> function from lmtest, I tried to use importFrom in my NAMESPACE:
>
> importFrom(lmtest, lrtest)
>
> However, this fails R CMD check in the examples:
> Error in UseMethod("lrtest") :
> no applicable method for 'lrtest' applied to an object of class
> "c('glm', 'lm')"
> Calls: assocTestRegression ... append -> RunRegression -> append
->
> unlist -> lrtest
>
> Relevant line of code in assocTestRegression is
> tmp <- append(tmp, unlist(lrtest(mod, mod0))[c(8,10)])
> where mod and mod0 are both results of the glm() function.
>
> If I instead import the entire package in my NAMESPACE:
>
> import(lmtest)
>
> The example runs without error. Is there a way to import all methods for
> an S3 generic function without importing the entire package?
>
> thanks,
> Stephanie Gogarten
>
> sessionInfo()
> R version 2.14.0 (2011-10-31)
> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] lmtest_0.9-28 zoo_1.7-4
>
> loaded via a namespace (and not attached):
> [1] grid_2.14.0 lattice_0.20-0 tools_2.14.0
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel