Disable Messages when Loading a Package in R (Example)

 

In this article you’ll learn how to suppress warning messages when loading an add-on package the first time in R programming.

The tutorial consists of this content:

Let’s start right away!

 

Example: Loading dplyr Package to RStudio

In this Example, I’ll show how to remove messages when loading a package in R. For this example, I’m using the dplyr package. First, we need to install and load the dplyr package:

install.packages("dplyr")                           # Install & load dplyr package
library("dplyr")

 

r graph figure 1 load package message

 

Figure 1 shows the messages that we receive when starting the dplyr package in RStudio.

If we want to disable such messages, we can use the suppressPackageStartupMessages function as shown below:

suppressPackageStartupMessages(library("dplyr"))  # Disable messages

No messages appear anymore!

 

Video, Further Resources & Summary

Do you need more explanations on the R codes of this article? Then you might want to have a look at the following video of my YouTube channel. I’m explaining the content of this post in the video:

 

The YouTube video will be added soon.

 

Furthermore, I can recommend to have a look at the related tutorials of https://statisticsglobe.com/. A selection of related tutorials about packages in R can be found below:

 

At this point of the page you should have learned how to disable package messages at startup in the R programming language. In case you have additional questions, let me know in the comments.

 



Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu
Top