[R] importing S4 methods using a namespace
Aaron Rendahl
arendahl at stat.umn.edu
Tue Feb 23 22:30:39 CET 2010
I want to call summary on a mer object (from lme4) within my package
but I can't seem to get the namespace to import the necessary method.
I've simplified my package to this one function:
---------------------------
ss <- function(m) {
summary(m)
}
---------------------------
And my namespace file looks like this, where I've attempted to follow
the instructions in "Writing R Extensions"
http://cran.r-project.org/doc/manuals/R-exts.html#Name-spaces-with-S4-classes-and-methods
---------------------------
import(lme4)
importMethodsFrom(lme4, "summary")
export("ss")
---------------------------
But when I call my new function, I get the summary.default method
instead of the mer method.
> m <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
> ss(m)
Length Class Mode
1 mer S4
Thanks,
--
Aaron Rendahl, Ph.D.
Statistical Consulting Manager
School of Statistics, University of Minnesota
NEW OFFICE (as of June 2009):
48C McNeal Hall, St. Paul Campus
612-625-1062
www.stat.umn.edu/consulting
More information about the R-help
mailing list