[英]Suppress package loading message in R package NAMESPACE
I am importing a package called "KernSmooth" and want the start up message not to show up ... 我正在导入一个名为“ KernSmooth”的程序包,并希望启动消息不显示...
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 load the package I still get the start up message: 但是,当我加载软件包时,仍然会收到启动消息:
KernSmooth 2.23 loaded
Copyright M. P. Wand 1997-2009
Is my only option not to import it in NAMESPACE and use 我唯一的选择是不将其导入NAMESPACE中并使用
suppressMessages(require(KernSmooth))
within my R function to avoid the message? 在我的R函数中避免出现此消息?
You can create a .Rprofile file in the main directory of your R project, in which you tell to suppress messages in response of certain commands. 您可以在R项目的主目录中创建.Rprofile文件,在其中告诉您抑制某些命令的响应消息。 Here it follows an example of .Rprofile that suppresses the startup messages for package(KernSmooth):
这里是一个.Rprofile的示例,该示例禁止显示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 the startup messages when you load package KernSmooth. 现在,每次启动R会话时,在加载软件包KernSmooth时都不会看到启动消息。
You can find more info on .Rprofile typing '?Startup' on your R console, or you can look at this discussion for .Rprofile examples: Expert R users, what's in your .Rprofile? 您可以在R控制台上找到有关.Rprofile的更多信息,键入'?Startup',也可以查看有关.Rprofile示例的讨论: 专家R用户,.Rprofile中有什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.