[R] Adding a method to a generic in another package
Jeffrey J. Hallman
jhallman at frb.gov
Tue Jun 2 23:14:19 CEST 2009
I am the maintainer of the 'tis' package. One of the functions in my package
is 'nberShade'. A user wants to make nberShade generic, with the old version
renamed as nberShade.default, all of which is fine with me. And he wants to
add a new method, nberShade.ggplot, which works for objects of class ggplot.
He also wants to add a method fortify.tis for the generic fortify defined in
ggplot2.
The nberShade.ggplot method uses a bunch of other functions from the ggplot2
package, and it's first line is
require("ggplot2")
>From what he tells me, this function works.
Where I'm having trouble is figuring out what I have to do to get the tis
package to pass R CMD check. I really don't want to force users of the tis
package to have to install ggplot2. What can I do? Is it enough to have
Imports: ggplot2
in the DESCRIPTION file and
import(ggplot2)
in the NAMESPACE file? I've done that, but I still get this warning from R
CMD check:
* checking for unstated dependencies in R code ... WARNING
'library' or 'require' calls not declared from:
ggplot2
See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.
Well, I did read the manual, and it seems to say that what I'm doing is OK. So
why am I getting the warning?
--
Jeff
More information about the R-help
mailing list