How to suppress warning messages when loading a library?

后端 未结 2 895
再見小時候
再見小時候 2020-12-29 19:16

I\'m trying to run a r script from the command line, but I get warning messages when packages are loaded:

C:\\Temp>Rscript myscript.r param
Warning messag         


        
2条回答
  •  清酒与你
    2020-12-29 19:46

    I put this at the top of all my scripts and preface my library loads with it:

    shhh <- suppressPackageStartupMessages # It's a library, so shhh!
    

    Then you can load the library thusly:

    shhh(library(tidyverse))
    

    and rely on perfect silence.

提交回复
热议问题