库/软件包开发-加载时的消息 [英] Library/package development - message when loading

查看:57
本文介绍了库/软件包开发-加载时的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户加载library(myCustomLibrary)时,是否有任何显示消息的方式? 加载后,我想显示一条消息,告诉用户如何运行所有测试功能.

is there any way to display a message when a user loads library(myCustomLibrary)? Upon loading, I want to display a message that tells the user how to run all the test functions.

推荐答案

是.加载包时,可以使用.onLoad.onAttach.First.lib函数执行所需的任何操作.我建议查看这些功能的帮助.您可以将.onLoad与命名空间结合使用,而将.First.lib与命名空间结合使用.

Yes. You can use the .onLoad, .onAttach, or .First.lib functions to do whatever you want when the package is loaded. I suggest looking at the help for those functions. You would use .onLoad with a namespace, and .First.lib without.

一个约定是,人们经常将这些命令放在单独的zzz.R文件中,该文件仅用于与软件包相关的代码.

One convention is that people will frequently put these commands in a separate zzz.R file, which is just used for package related code.

这篇关于库/软件包开发-加载时的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆