Suppress package download message in NAMESPACE R package

I am importing a package called "KernSmooth" and want the startup message not to display ...

In my description file:

Package: test Title: Test Author: Mike Description: Test Maintainer: Mike Depends: R(>= 2.10.0) Imports: KernSmooth 

And my namespace file:

 import(KernSmooth) 

But when I download the package, I still get a startup message:

 KernSmooth 2.23 loaded Copyright MP Wand 1997-2009 

I am the only option not to import it into NAMESPACE and use

 suppressMessages(require(KernSmooth)) 

inside my R function to avoid the message?

+7
namespaces r
source share
1 answer

You can create a .Rprofile file in the main directory of your R project in which you report in order to suppress messages in response to certain commands. Here's an example .Rprofile that suppresses the initial messages for a package (KernSmooth):

 #This is the command you must put in your .Rprofile: #obviously you can choose other packages instead of #KernSmooth, as well as include other personal settings suppressPackageStartupMessages(library(KernSmooth)) 

Now, every time you start your R session, you will not see start messages when you download the KernSmooth package.

You can find more information about .Rprofile by typing "Startup" on your R console, or you can look at this discussion for .Rprofile examples: Expert R users, what's in your .Rprofile?

+1
source share

All Articles