cmd – how to remove warnings when executing r-script on the command line?

Question:

I run the script via cmd . I would like to receive in response only the result of the script execution, namely the line "Calculation completed!"

But during the execution of the script, warnings are issued. I managed to get rid of some of them. But one thing remains. Moreover, if you run it through RStudio , then there are no warnings, since I added warn=-1 to the parameters

you receive the following warning: Attaching package: 'zoo' The following objects are masked from 'package: base': as.Date, as.Date.numeric

How to remove this warning.

Answer:

This is how it should help:

suppressPackageStartupMessages(library(zoo))
Scroll to Top