我正在构建一个R包,其中包含一些相关数据。我使用usethis::functions创建了一个data-raw文件夹,在其中放置了各种txt文件,并构建了R代码来生成.rda/Rdata文件。我已经使用use_data()函数生成了.rda和Rdata文件,我可以在/data中看到这些文件。
我可以使用load_all()检索这些对象。
然后,我构建了一个源包,它会生成一个压缩的tar-ball。
最后,我尝试在另一个项目中安装tar-ball/包,并获得:
devtools::install_local("/home/fred/Rprojects/evidently/evidently_0.0.2.1.tar.gz")
✓ checking for file ‘/tmp/Rtmp53yb8S/remotes2eaf7a4fc2cb/evidently/DESCRIPTION’ ...
─ preparing ‘evidently’:
✓ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘evidently_0.0.2.1.tar.gz’
Installing package into ‘/home/rob/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘evidently’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error : **'/tmp/Rtmp0PbObQ/R.INSTALL391126f5cc7c/evidently/data-raw/TPBULET-A.txt' does not exist.**
Error: unable to load R code in package ‘evidently’
Execution halted
ERROR: lazy loading failed for package ‘evidently’
* removing ‘/home/fred/R/x86_64-pc-linux-gnu-library/4.0/evidently’
* restoring previous ‘/home/rob/R/x86_64-pc-linux-gnu-library/4.0/evidently’
Error: Failed to install 'evidently' from local:
(converted from warning) installation of package ‘/tmp/Rtmp53yb8S/file2eaf5f6ca68c/evidently_0.0.2.1.tar.gz’ had non-zero exit status
> 但它说要查找的文件在包文件夹中的data-raw中。
我在这里遗漏了一些明显的东西。我欢迎关于为什么系统看不到txt文件,以及为什么它因此中止安装的建议。
发布于 2021-03-21 01:46:22
当你在一个你认为已经清除的文件中有一个指向data-raw文件的恶意链接时,就会发生这种情况,当它作为install-packages的一部分被加载时,它会试图在data-raw/中找到一个不在这个包中的文件,因为data-raw/不是这个包的一部分,而只是在源代码中。因此,搜索您的文件并找到被遗忘的代码。羞愧地低下头。
https://stackoverflow.com/questions/66715862
复制相似问题