“object not found” during package build/install

穿精又带淫゛_ 提交于 2020-01-06 06:04:15

问题


I'm at a loss to debug building/installing a package. Building a package "MyProjekt" through

> devtools::build("MyProjekt")

works fine, even though

> devtools::document()
Updating MyProjekt documentation
Loading MyProjekt
Error: object 'rank' not found whilst loading namespace 'MyProjekt'

fails.

Attempting to install the built (pure R) package

> install.packages(pkgs="./MyProjekt.tar.gz")
...
Error: package or namespace load failed for 'MyProjekt':
 object 'rank' not found whilst loading namespace 'MyProjekt'
Error: loading failed
Execution halted
...
ERROR: loading failed for 'i386', 'x64'

also fails.

Unfortunately the term 'rank' is a common term in my domain and I have hundreds of hits when searching in my files for that term.

How might I start a systematic way to hunt this bug down?


回答1:


The toolchain mistakenly generates S3method(...) in the NAMESPACE file.

Follow this answer and edit the NAMESPACE file by hand. Replace occurrences of S3method(f) with export(f).

I'm not certain this is repeatable. The generated files appear to be not just written, but also read during a subsequent package build (by devtools? by roxygen2?). Add your comments if this works/does not work for you.



来源:https://stackoverflow.com/questions/50728217/object-not-found-during-package-build-install

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!