Skip to content

Article describing how to handle (and suppress) package startup messages #187

@PeteHaitch

Description

@PeteHaitch

I almost always want to wrap library() in suppressPackageStartupMessages() for my reprexes, but I always forget the first time around :( This is particularly true for Bioconductor packages, which tend to be very noisy because many depend on BiocGenerics (which masks a bunch of base function with equivalent S4 generics and reports this fact). For example, here I load the widely used SummarizedExperiment Bioconductor package:

library(SummarizedExperiment)
#> Loading required package: GenomicRanges
#> Loading required package: stats4
#> Loading required package: BiocGenerics
#> Loading required package: parallel
#> 
#> Attaching package: 'BiocGenerics'
#> The following objects are masked from 'package:parallel':
#> 
#>     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
#>     clusterExport, clusterMap, parApply, parCapply, parLapply,
#>     parLapplyLB, parRapply, parSapply, parSapplyLB
#> The following objects are masked from 'package:stats':
#> 
#>     IQR, mad, sd, var, xtabs
#> The following objects are masked from 'package:base':
#> 
#>     anyDuplicated, append, as.data.frame, basename, cbind,
#>     colMeans, colnames, colSums, dirname, do.call, duplicated,
#>     eval, evalq, Filter, Find, get, grep, grepl, intersect,
#>     is.unsorted, lapply, lengths, Map, mapply, match, mget, order,
#>     paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind,
#>     Reduce, rowMeans, rownames, rowSums, sapply, setdiff, sort,
#>     table, tapply, union, unique, unsplit, which, which.max,
#>     which.min
#> Loading required package: S4Vectors
#> 
#> Attaching package: 'S4Vectors'
#> The following object is masked from 'package:base':
#> 
#>     expand.grid
#> Loading required package: IRanges
#> Loading required package: GenomeInfoDb
#> Loading required package: Biobase
#> Welcome to Bioconductor
#> 
#>     Vignettes contain introductory material; view with
#>     'browseVignettes()'. To cite Bioconductor, see
#>     'citation("Biobase")', and for packages 'citation("pkgname")'.
#> Loading required package: DelayedArray
#> Loading required package: matrixStats
#> 
#> Attaching package: 'matrixStats'
#> The following objects are masked from 'package:Biobase':
#> 
#>     anyMissing, rowMedians
#> Loading required package: BiocParallel
#> 
#> Attaching package: 'DelayedArray'
#> The following objects are masked from 'package:matrixStats':
#> 
#>     colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges
#> The following objects are masked from 'package:base':
#> 
#>     aperm, apply

Created on 2018-03-28 by the reprex package (v0.2.0).

Session info
devtools::session_info()
#> Session info -------------------------------------------------------------
#>  setting  value                                             
#>  version  R Under development (unstable) (2018-03-05 r74359)
#>  system   x86_64, darwin15.6.0                              
#>  ui       X11                                               
#>  language (EN)                                              
#>  collate  en_AU.UTF-8                                       
#>  tz       America/New_York                                  
#>  date     2018-03-28
#> Packages -----------------------------------------------------------------
#>  package              * version   date       source        
#>  backports              1.1.2     2017-12-13 CRAN (R 3.5.0)
#>  base                 * 3.5.0     2018-03-06 local         
#>  Biobase              * 2.39.2    2018-01-25 Bioconductor  
#>  BiocGenerics         * 0.25.3    2018-02-09 Bioconductor  
#>  BiocParallel         * 1.13.3    2018-03-23 Bioconductor  
#>  bitops                 1.0-6     2013-08-17 CRAN (R 3.5.0)
#>  compiler               3.5.0     2018-03-06 local         
#>  datasets             * 3.5.0     2018-03-06 local         
#>  DelayedArray         * 0.5.22    2018-03-02 Bioconductor  
#>  devtools               1.13.5    2018-02-18 CRAN (R 3.5.0)
#>  digest                 0.6.15    2018-01-28 CRAN (R 3.5.0)
#>  evaluate               0.10.1    2017-06-24 CRAN (R 3.5.0)
#>  GenomeInfoDb         * 1.15.5    2018-02-04 Bioconductor  
#>  GenomeInfoDbData       1.1.0     2017-12-16 Bioconductor  
#>  GenomicRanges        * 1.31.23   2018-03-28 Bioconductor  
#>  graphics             * 3.5.0     2018-03-06 local         
#>  grDevices            * 3.5.0     2018-03-06 local         
#>  grid                   3.5.0     2018-03-06 local         
#>  htmltools              0.3.6     2017-04-28 CRAN (R 3.5.0)
#>  IRanges              * 2.13.28   2018-02-24 Bioconductor  
#>  knitr                  1.20      2018-02-20 CRAN (R 3.5.0)
#>  lattice                0.20-35   2017-03-25 CRAN (R 3.5.0)
#>  magrittr               1.5       2014-11-22 CRAN (R 3.5.0)
#>  Matrix                 1.2-12    2017-11-20 CRAN (R 3.5.0)
#>  matrixStats          * 0.53.1    2018-02-11 CRAN (R 3.5.0)
#>  memoise                1.1.0     2017-04-21 CRAN (R 3.5.0)
#>  methods              * 3.5.0     2018-03-06 local         
#>  parallel             * 3.5.0     2018-03-06 local         
#>  Rcpp                   0.12.16   2018-03-13 CRAN (R 3.5.0)
#>  RCurl                  1.95-4.10 2018-01-04 CRAN (R 3.5.0)
#>  rmarkdown              1.9       2018-03-01 CRAN (R 3.5.0)
#>  rprojroot              1.3-2     2018-01-03 CRAN (R 3.5.0)
#>  S4Vectors            * 0.17.38   2018-03-28 Bioconductor  
#>  stats                * 3.5.0     2018-03-06 local         
#>  stats4               * 3.5.0     2018-03-06 local         
#>  stringi                1.1.7     2018-03-12 CRAN (R 3.5.0)
#>  stringr                1.3.0     2018-02-19 CRAN (R 3.5.0)
#>  SummarizedExperiment * 1.9.16    2018-03-28 Bioconductor  
#>  tools                  3.5.0     2018-03-06 local         
#>  utils                * 3.5.0     2018-03-06 local         
#>  withr                  2.1.2     2018-03-15 CRAN (R 3.5.0)
#>  XVector                0.19.9    2018-02-28 Bioconductor  
#>  yaml                   2.1.18    2018-03-08 CRAN (R 3.5.0)
#>  zlibbioc               1.25.0    2017-10-31 Bioconductor

Created on 2018-03-28 by the reprex package (v0.2.0).

Yeeesh ...

I see reprex() has a tidyverse_quiet argument and that there was some discussion of the more general case in #70. Would you be amenable to revisiting this issue? I'd be happy to lead a PR.

Thanks for a very useful package!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions