[R-pkg-devel] how to suppress undesired messages

Michael Chirico m|ch@e|ch|r|co4 @end|ng |rom gm@||@com
Thu Apr 16 22:25:17 CEST 2026


Hey Adelchi,

Why do you have sn and ggplot2 as Depends? My own very strong opinion is
that authors of new packages should never use it.

Move them to Imports, and use 'import(sn)' and 'import(ggplot2)' in your
NAMESPACE if you really want the whole packages.

Mike C

On Thu, Apr 16, 2026 at 8:15 AM Adelchi Azzalini <azzalini using stat.unipd.it>
wrote:

> Hi. I am preparing a new package, called gg.sn, which in essence provides
> ggplot2-style graphics as a replacement for the existing graphics produced
> by package sn.  The new package works by loading new functions and methods
> with the same names and calling statements of those in package sn (after sn
> has been loaded), effectively superseding them with the new ones.
>
> My current task is to get rid of a spate of undesired messages which
> appear at start-up of gg.sn, as show in the list copied at the end of
> this message; the line numbers have been added for helping referencing the
> lines.
>
> For lines 3 to 5, I know where they come from: they are start-up messages
> from ’sn’; so I can drop them, since I am the author of sn. All the rest is
> outside my control. Question: is it possible to get rid of these other
> messages and, in case, how?
>
> The DESCRIPTION file includes these lines:
> Depends: R (>= 4.2.0), sn (>= 2.1.3),  ggplot2 (>= 3.4.2)
> Imports: methods, mnormt (>= 2.1.2), patchwork (>= 1.1.2)
>
> Given these declarations, there are no loading commands to which I could
> possibly apply suppressPackageStartupMessages().
>
> Also, there is no start-up message issued by gg.sn, whose .onAttach
> function only contains
> .onAttach <- function(library, pkg)
> {
>  if(interactive())
>   {
>     meta <- packageDescription("gg.sn”)
>   }
>  invisible()
> }
>
> apart from various comment lines.
>
> Best regards.
>
> ---
> Adelchi Azzalini
> http://azzalini.stat.unipd.it
>
>
>  0 R> library(gg.sn)
>  1 Loading required package: sn
>  2 Loading required package: stats4
>  3 Package 'sn', 2.1.3 (2026-02-24).
>  4 Type 'help(SN)' and 'help("overview-sn")' for basic information.
>  5 The package redefines function 'sd' but its usual working is unchanged.
>  6
>  7 Attaching package: ‘sn’
>  8
>  9 The following object is masked from ‘package:stats’:
> 10
> 11     sd
> 12
> 13 Loading required package: ggplot2
> 14 Registered S3 method overwritten by 'gg.sn':
> 15   method                from
> 16   plot.fitdistr.grouped sn
> 17
> 18 Attaching package: ‘gg.sn’
> 19
> 20 The following object is masked from ‘package:sn’:
> 21
> 22     plot2D.SymmModulated
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list