[英]Suppress package loading message in R package NAMESPACE
我正在导入一个名为“ KernSmooth”的程序包,并希望启动消息不显示...
在我的描述文件中:
Package: test
Title: Test
Author: Mike
Description: Test
Maintainer: Mike
Depends: R(>= 2.10.0)
Imports: KernSmooth
还有我的命名空间文件:
import(KernSmooth)
但是,当我加载软件包时,仍然会收到启动消息:
KernSmooth 2.23 loaded
Copyright M. P. Wand 1997-2009
我唯一的选择是不将其导入NAMESPACE中并使用
suppressMessages(require(KernSmooth))
在我的R函数中避免出现此消息?
您可以在R项目的主目录中创建.Rprofile文件,在其中告诉您抑制某些命令的响应消息。 这里是一个.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))
现在,每次启动R会话时,在加载软件包KernSmooth时都不会看到启动消息。
您可以在R控制台上找到有关.Rprofile的更多信息,键入'?Startup',也可以查看有关.Rprofile示例的讨论: 专家R用户,.Rprofile中有什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.