将config.yml放在r软件包中
我正在创建一个使用 config.yml 文件。
我的问题是:config.yml
去哪里? config.get()
期望它位于根目录中,因此,如果我将其放在< my_package>/config.yml
中,它将毫无问题地定位它。但是,devtools :: check()
讨厌以下内容:
在顶级找到的非标准文件/目录: 'config.yml'
最近的说明我已经看到,仅当仅将配置文件用于单元测试时,我应该做的事情。那不是我的情况;我需要该配置实际上由软件包本身使用。我知道我可以通过将其放入< my_package>/r/
之类的目录中来解决此问题,然后替换conify> config> contig> get()
config :: get之类的东西(there ::此处('r/config.yml'))
,但这似乎是黑客的。
有建议这样做吗?
I am creating an R package that uses the config package to read a config.yml
file.
My question is: where does config.yml
go? config.get()
expects it to be in the root directory, so if I put it at <my_package>/config.yml
, it locates it with no problem. However, devtools::check()
hates this:
Non-standard file/directory found at top level:
'config.yml'
The closest explanation I've seen for what you are supposed to do only applies to when the config file is only used for unit tests. That's not my case; I need this config to actually be used by the package itself. I know I could fix this by just putting it in a directory like <my_package>/R/
and replacing every invocation of config::get()
with something like config::get(here::here('R/config.yml'))
, but that seems hacky.
Is there a recommended way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
进入
Inst/
。访问实际位置Goes under
inst/
. Access the actual location with