[R-pkg-devel] Package Deprecation Message

pik@pp@@devei m@iii@g oii gm@ii@com pik@pp@@devei m@iii@g oii gm@ii@com
Tue May 31 23:10:50 CEST 2022


Dear all,

 

I am looking for a way to communicate the deprecation of a package as a
newer package supersedes it. 

 

1 ) My initial approach was to emit a warning message during the deprecated
package's loading, i.e., something like the following lines

 

.onLoad <- function(libname, pkgname) {

    message <- "Some deprecation message."

    rlang::warn(message)

}

 

This approach leads to the following warning during RCHECK

 

* checking whether package 'package_name' can be installed ... WARNING

Found the following significant warnings:

  Warning: Some deprecation message.

 

2) My subsequent approach was to use packageStartupMessage, i.e.

 

 

.onLoad <- function(libname, pkgname) {

    message <- "Some deprecation message."

    packageStartupMessage(message, appendLF = TRUE)

}

 

This approach leads to a note

 

* checking R code for possible problems ... NOTE

File 'package_name/R/zzz.R': .onLoad calls: packageStartupMessage(message,
appendLF = TRUE)

See section 'Good practice' in '?.onAttach'.

 

Unfortunately, the package fails to pass the CRAN's automated incoming
checks with this note.

 

I have checked the 'Good practice' section of the .onAttach help page. It
starts with:

 

"Loading a namespace should where possible be silent, with startup messages
given by '.onAttach'. 

These messages (and any essential ones from '.onLoad') should use
packageStartupMessage so they can be silenced where they would be a
distraction."

 

>From the above passage, I understand that essential messages can be
communicated from .onLoad. Should I consider the deprecation message as
essential and leave it in the body of .onLoad, or should I instead use
.onAttach in order to submit the package to CRAN? 

 

Is there maybe a better way to communicate that the package is deprecated?

 

Kind regards,

Pantelis

 

 


	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list