[R] how to remove all messages when loading a library ?

Fabien Tarrade fabien.tarrade at gmail.com
Sun Sep 25 21:22:37 CEST 2016


Hi there,

I would like to remove all messages when I load library (I fact I am 
using "require" and "install.packages"). I tried many options and look 
at the documentation for the 2 functions.
For example I am using the following piece of code: init.R

print("step 1")
# Install library if not installed
if (!require("plyr",quietly=TRUE,warn.conflicts=FALSE)) 
suppressMessages(install.packages("plyr",quietly=TRUE))
if (!require("dplyr",quietly=TRUE)) 
suppressMessages(install.packages("dplyr",quietly=TRUE))
if (!require("stringr",quietly=TRUE)) 
suppressMessages(install.packages("stringr",quietly=TRUE))
if (!require("readr",quietly=TRUE)) 
suppressMessages(install.packages("readr",quietly=TRUE))
if (!require("tidyr",quietly=TRUE)) 
suppressMessages(install.packages("tidyr",quietly=TRUE))
if (!require("XML",quietly=TRUE)) 
suppressMessages(install.packages("XML",quietly=TRUE))
if (!require("Rcpp",quietly=TRUE)) 
suppressMessages(install.packages("Rcpp",quietly=TRUE))
if (!require("rbenchmark",quietly=TRUE)) 
suppressMessages(install.packages("rbenchmark",quietly=TRUE))
if (!require("tiff",quietly=TRUE)) 
suppressMessages(install.packages("tiff",quietly=TRUE))
if (!require("xlsx",quietly=TRUE)) 
suppressMessages(install.packages("xlsx",quietly=TRUE))
if (!require("ROracle",quietly=TRUE)) 
suppressMessages(install.packages("T:/CH/R/ROracle_1.2-2.zip", repos = 
NULL, type = "source",quietly=TRUE))
print("step 2")

and I run the code in this way:
 > source("./init.R",encoding = 
"UTF-8",verbose=FALSE,echo=FALSE,print.eval=FALSE)

and I get the following output that I don't manage to remove:

[1] "step 1"

Attache Paket: ‘dplyr’

Die folgenden Objekte sind maskiert von ‘package:plyr’:

     arrange, count, desc, failwith, id, mutate, rename, summarise, 
summarize

Die folgenden Objekte sind maskiert von ‘package:stats’:

     filter, lag

Die folgenden Objekte sind maskiert von ‘package:base’:

     intersect, setdiff, setequal, union
[1] "step 2"

What is the way to get no messages at all when loading library ? ( or 
using other R function in general).
I am trying to keep only the important messages and so far I am getting 
way too much messages.

Thanks
Cheers
Fabien


-- 
Dr Fabien Tarrade

Quantitative Analyst/Developer - Data Scientist

Senior data analyst specialised in the modelling, processing and 
statistical treatment of data.
PhD in Physics, 10 years of experience as researcher at the forefront of 
international scientific research.
Fascinated by finance and data modelling.

Zurich, Switzerland

Email : contact at fabien-tarrade.eu <mailto:contact at fabien-tarrade.eu>
Phone : www.fabien-tarrade.eu <http://www.fabien-tarrade.eu>

LinkedIn <http://ch.linkedin.com/in/fabientarrade/> Twitter 
<https://twitter.com/fabtar> Google 
<https://plus.google.com/+FabienTarradeProfile/posts> Facebook 
<https://www.facebook.com/fabien.tarrade.eu> Google 
<skype:fabtarhiggs?call> Xing <https://www.xing.com/profile/Fabien_Tarrade>


More information about the R-help mailing list