I've been developing a package and have been getting the following warning when running the check command: * checking S3 generic/method consistency ... WARNING plot: function(x, ...) plot.summaries: function(trees, sp) * checking for replacement functions with final arg not named 'value' ... OK * checking Rd files ... OK ...blah, blah, blah... * checking examples ... OK * creating cruisepak-manual.tex ... OK * checking cruisepak-manual.tex ... OK WARNING: There were 3 warnings, see C://cruisepak.Rcheck/00check.log for details C:\> I can fix the other two warnings with no problem, but the S3 generic/method consistency warning is puzzling me... . I have a function called plot.summaries <- function( trees, sp=NULL ) { ...yak, kay, yak... } and I'm not sure if this is causing the problem. I'm developing a package for forestry and the field makes use of many terms commonly found in technology (logs, trees, plots, points, etc) and would like to know if the nomenclature will cause a problem. Thanks, Jeff. --- Jeff D. Hamann Forest Informatics, Inc. PO Box 1421 Corvallis, Oregon USA 97339-1421 (office) 541-754-1428 (cell) 541-740-5988 jeff.hamann at forestinformatics.com www.forestinformatics.com --- Jeff D. Hamann Forest Informatics, Inc. PO Box 1421 Corvallis, Oregon USA 97339-1421 (office) 541-754-1428 (cell) 541-740-5988 jeff.hamann at forestinformatics.com www.forestinformatics.com
Jeff D. Hamann wrote:> I've been developing a package and have been getting the following warning > when running the check command: > > * checking S3 generic/method consistency ... WARNING > plot: > function(x, ...) > plot.summaries: > function(trees, sp) >I'm unclear; is "summaries" a class? If not, try naming the function plotSummaries, or some such thing (no dot ".") Cheers Jason -- Indigo Industrial Controls Ltd. http://www.indigoindustrial.co.nz 64-21-343-545 jasont at indigoindustrial.co.nz
A 18:35 02/12/2003 +1300, Jason Turner a ?crit:>Jeff D. Hamann wrote: > >>I've been developing a package and have been getting the following warning >>when running the check command: >>* checking S3 generic/method consistency ... WARNING >>plot: >> function(x, ...) >>plot.summaries: >> function(trees, sp) > >I'm unclear; is "summaries" a class? If not, try naming the function >plotSummaries, or some such thing (no dot ".") > >CheersAnd if yes, you can rename the main argument inside the function: plot.summaries <- function(x, sp, ...) { trees <- x rm(x) [...] } This allows you to keep the object name 'trees' inside the function. Note that the "dot dot dot" (...) argument MUST be included in this case (use of the generic function plot). Have a look at the Writing R Extensions manual: there are very useful information there when writing a package. Emmanuel Paradis>Jason >-- >Indigo Industrial Controls Ltd. >http://www.indigoindustrial.co.nz >64-21-343-545 >jasont at indigoindustrial.co.nz > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help
On Mon, 1 Dec 2003, Jeff D. Hamann wrote:> I have a function called > > plot.summaries <- function( trees, sp=NULL ) { > ...yak, kay, yak... > } > > and I'm not sure if this is causing the problem. I'm developing a package > for forestry and the field makes use of many terms commonly found in > technology (logs, trees, plots, points, etc) and would like to know if the > nomenclature will cause a problem. >Yes, that's the problem. Yes, it's annoying. Yes, there's a good reason for it. If you define a method for plot, it has to be compatible with the generic and it has to be able to be extended if someone else develops a subclass of your class. As long as no-one extends your code, and the function is always called as plot(some.tree.thing) there isn't a problem. But if someone calls plot(trees=some.tree.thing) this doesn't match the generic. If plot.summaries() isn't a method for plot then it should be called something else, like plotSummaries(). -thomas