rstudio“安装和重新启动”不忽略.rbuildignore中的文件
我的.rbuildignore指定了以下文件:
^inst/extdata$
这是一个目录,该目录容纳了我使用的一些.csv
文件。
当我使用“安装和重新启动”按钮构建软件包时,这些文件夹包含在构建软件包中,如:
> list.files(system.file(package = 'myPackage'), recursive = T, full.names = T)
...
[6] "C:/Users/JohnDoe/R/win-library/4.0/myPackage/extdata/df.csv"
...
如果我使用命令devtools :: install()
, inst/extdata
文件夹在构建过程中正确忽略了。这使我相信差异在于“安装和重新启动”按钮。有什么方法可以将此按钮映射到devtools :: install()
命令?
My .Rbuildignore specifies these files:
^inst/extdata$
This is a directory that holds some .csv
files I use.
When I build my package with the "Install and Restart" button, these folders are included in the built package as demonstrated by:
> list.files(system.file(package = 'myPackage'), recursive = T, full.names = T)
...
[6] "C:/Users/JohnDoe/R/win-library/4.0/myPackage/extdata/df.csv"
...
However, if I build my package with the command devtools::install()
, the inst/extdata
folder is correctly ignored in the build process. This leads me to believe the discrepancy lies in the "Install and Restart" button. Is there any way to map this button to the devtools::install()
command?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
.rbuildignore
由r cmd build
命令使用。如果您直接从目录中安装而无需构建TARBALL,则不会使用。对于基本r cmd install
以及rstudio
仿真都是如此。因此,您应该做的是将文件放置在其他未由
r cmd install
处理的地方,例如在目录ignoreme
中,而不是名称的名称,其名称为“安装”我”。如果您不想这样做,那么可以将任意r命令附加到Rstudio中的键,但这是很多工作。请参阅 http://rstudio.github.io/rstudioaddins/ 如果您想要详细信息。
.Rbuildignore
is used by theR CMD build
command. If you install directly from a directory without building a tarball, it's not used. This is true for baseR CMD INSTALL
as well as theRStudio
emulations of it.So what you should do is to put the files somewhere else that isn't handled by
R CMD INSTALL
, for example in directoryignoreMe
instead of a directory whose name means "install me".If you don't want to do that, then it is possible to attach arbitrary R commands to keys in RStudio, but that's a lot of work. See http://rstudio.github.io/rstudioaddins/ if you want the details.