[R-pkg-devel] Deprecating apparent S3 method, changing name

Jan van der Laan rhe|p @end|ng |rom eoo@@dd@@n|
Sun Sep 29 13:46:32 CEST 2024


Hmm, the following doesn't seem to trigger warnings or notes in `R CMD 
check --as-cran` (R 4.4.1; linux)

esa <- function(x) { 
  

   UseMethod("esa") 
  

} 
  

  
  

esa.plot <- function(y) { 
  

   .Deprecated("esaPlot") 
  

   esaPlot(y) 
  

} 
  

  
  

esaPlot <- function(y) { 
  

   message("esaPlot") 
  

} 
  

  
  

esa.numeric <- function(x) { 
  

   message("esa.numeric") 
  

} 
  



With NAMESPACE:
  
  

S3method(esa, numeric) 
  

export(esa) 
  

export(esa.plot) 
  

export(esaPlot)

Am I doing something different than you are?

Jan


On 9/25/24 07:13, Murray Efford via R-package-devel wrote:
> A package of mine on CRAN has some old function names (not S3 methods) that include "." (e.g., "esa.plot"). In a new version I want to simultaneously
> 1. rename these functions to e.g. "esaPlot"
> 2. export a new S3 generic with the base name (e.g. "esa") and methods for different model types (e.g. "esa.secr").
> 
> When I deprecate the old functions (by exporting a shell function that calls .Deprecated and the new function), I get a package check note for e.g. esa.plot
> "* checking S3 generic/method consistency ... NOTE
> Apparent methods for exported generics not registered: etc."
> 
> This is understandable, but how can I avoid it while properly deprecating the old functions? I seem to remember a recent question like this, but I'm sorry I cannot find it.
> 
> Murray
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list