Hello, I am wondering if there is a way to suppress ALL start up messages in loading packages. In other words, I have a lot of library calls, like so:
require(splines)
require(ggplot2)
require(dplyr)
require(tidyverse)
require(reshape2)
require(knitr)
require(MASS)
require(moanin)
require(topGO)
I would like for none of these to print messages about conflicts or the "Welcome to Bioconductor" message etc. BUT I don't want to put suppressPackageStartupMessages
in front of every call (and remember to do it for every new library I might add in the future).
For context, this is not interactive code. This is code run on the command line (via a makefile) using Rscript
and these messages really clog up my output. Moreover, I have a large pipeline of code, so I have a slew of such existing .R
/.Rmd
files to compile, so in addition to not wanting to have the messy code, I don't want to manually have to add suppressPackageStartupMessages
manually to each call in each file. I'd rather add a single line of code at the top of each existing file.
Finally, I know that in Rmarkdown, I can set the option message=FALSE
, so it doesn't show up in my compiled output. However, I am not only running .Rmd files. Furthermore, even for those that are .Rmd, I am running them via Rscript
so that while those messages don't show up in the html compiled file, it does get output to the terminal (not sure why) hence making very cluttered output when I'm trying to review the output of my calls that I've piped to a log file.
Thanks so much for any suggestions!
Elizabeth Purdom
While technically possible I'd discourage this as for example
renv
expect standard syntax such aslibrary()
orrequire()
to detect packages for its snapshotting: https://github.com/rstudio/renv/issues/720