[R-pkg-devel] Change package name

Spencer Graves @pencer@gr@ve@ @end|ng |rom e||ect|vede|en@e@org
Thu Jun 22 04:44:10 CEST 2023



On 6/21/23 8:33 PM, Rolf Turner wrote:
> 
> On Tue, 20 Jun 2023 17:39:48 -0400
> <avi.e.gross using gmail.com> wrote:
> 
>> If you really need a new package name, is there an accepted way to
>> update the old name to at least provide a message for a while as to
>> the new name to use and perhaps have the load otherwise fail?
> 
> I don't know about "accepted", but the following paradigm seems to me
> to be sensible and reasonably efficacious:
> 
> * you have a package "foo" the name of which you wish to change to "bar"
> * create a new package "bar" which is the same as "foo" except for its
>    name
> * now replace foo with a skeleton package which has only the file
>    First.R in its R directory
> * the file First.R should be something like:
> 
>> .onAttach <- function(lib, pkg) {
>> 	ver <- read.dcf(file.path(lib, pkg, "DESCRIPTION"), "Version")
>>          packageStartupMessage(paste(pkg, ver))
>>          msg <- paste("\n     This package, \"foo\" is now",
>>                       " deprecated.  Users",
>>                       "\n     should install and use its",
>>                       " successor  \"bar\".\n")
>>          packageStartupMessage(msg) }
> 
> * submit both "bar" and "foo" to CRAN


	  Years ago, I had package "RSiteSearch".  I asked some R list what 
might be a better name for that.  "sos" was suggested, and Duncan 
Murdoch contributed code for an enhancement.  Then I added something 
like ".onAttach" to "RSiteSearch" and kept it on CRAN for a couple of 
years after introducing "sos".  That allowed people to use the old 
package for a couple of years without forcing them to switch immediately.


	  I think that worked quite well.


	  Hope this helps.
	  Spencer Graves

> 
> cheers,
> 
> Rolf Turner
>



More information about the R-package-devel mailing list