That doesn't sound correct. I just created a simple package with DESCRIPTION
Package: PkgA Title: What the Package Does (one line, title case) Version: 0.0.0.9000 Authors@R: person("First", "Last", email = "first.l...@example.com", role = c("aut", "cre")) Description: What the package does (one paragraph). Depends: R (>= 3.5.1) Imports: phylobase, methods License: Artistic-2.0 Encoding: UTF-8 LazyData: true NAMESPACE import(methods) importMethodsFrom(phylobase, "nNodes") exportMethods("nNodes") and R/cls.R .A = setClass("A", slots = c(x="numeric")) setMethod("nNodes", "A", function(x) "I'm an 'A'") This package builds and checks OK (complaining about documentation, but...) and nNodes can be used. Do you have more information on the problem that you are seeing? Is it a problem with roxygen2? Martin On 10/19/18, 12:18 PM, "Bioc-devel on behalf of Elizabeth Purdom" <bioc-devel-boun...@r-project.org on behalf of epur...@stat.berkeley.edu> wrote: Sorry, I copied the wrong code from phylobase (I copied the setMethod code). Their setGeneric calls are in the following format: setGeneric("nNodes", function(x) { standardGeneric("nNodes") }) > On Oct 19, 2018, at 9:07 AM, Elizabeth Purdom <epur...@stat.berkeley.edu> wrote: > > Hello, > > In my package (`clusterExperiment`) I want to extend a S4 method from a package `phylobase` for my class. However, in the phylobase package, all of the `setGeneric` calls are in the form of > > setMethod("nTips", signature(x="phylo"), > function(x) { > Ntip(x) > }) > > Namely, they use braces in their function definitions, which I have just learned creates a `nonstandardGenericFunction` rather than a `standardGeneric`. Because of this I can’t just do `importMethodFrom` and then just extend the method. And if I try to create my own `standardGeneric` (e.g. https://stat.ethz.ch/R-manual/R-devel/library/methods/html/Methods_for_Nongenerics.html <https://stat.ethz.ch/R-manual/R-devel/library/methods/html/Methods_for_Nongenerics.html>) I can no longer call the function in the original `phylobase` package, i.e. for the original class for which it is applied. > > My only solution appears to be if I put `phylobase` in the `Depends` section, at which point I can then extend their generics. But this gives my package the significant warning: > > " Warning: replacing previous import ‘phylobase::plot’ by ‘graphics::plot’ when loading ‘clusterExperiment’” > > My question is whether there is anything I can do on my end to either 1) extend phylobase generics without a depends statement or 2) to get rid of the warning about the imports (I have made sure to use `graphics::plot` in all of my functions’ calls to plot to make sure there is no problem with the import conflict)? > > Or is my only hope to have the developers of the package fix their calls? Personally, I was going to strip my setGeneric calls of braces after this experience, since I also have braces in my call but not for any good reason. Is there a good reason that setGenerics might have the braces in their calls? (Hadley’s Advanced R seems to say no, perhaps for this reason https://adv-r.hadley.nz/s4.html#generics-and-methods <https://adv-r.hadley.nz/s4.html#generics-and-methods>). Does using braces keep you from colliding with future developers or other packages? > > Thanks, > Elizabeth > > > > [[alternative HTML version deleted]] _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel