我正在创建一个R包,其中包含取决于RcppArmadillo的Rcpp函数,因此我首先通过RcppArmadillo.package.skeleton
生成包框架。但是,当我roxygenize
我的包裹时,它给了我下面显示的错误。
R代码
library(roxygen2)
library(RcppArmadillo)
library(Rcpp)
RcppArmadillo.package.skeleton(name = "prac_181206", example_code = FALSE)
roxygenize(package.dir = "prac_181206", roclets = "rd")
错误
Error in getDLLRegisteredRoutines.DLLInfo(dll, addNames = FALSE) :
must specify DLL via a “DLLInfo” object. See getLoadedDLLs()
花了一些时间后,我发现可以通过删除.registration
文件中的NAMESPACE
选项来解决此问题。
原始NAMESPACE文件
useDynLib(prac_181206, .registration=TRUE)
importFrom(Rcpp, evalCpp)
exportPattern("^[[:alpha:]]+")
简而言之,将上面的第一行更改为useDynLib(prac_181206)
后,它可以正常工作,但我不知道该错误意味着什么以及为什么我的解决方案有效。
您能帮我解决这个问题吗?我很感激!
因为这是一个玩具示例,希望可以重现,所以我没有在上述man
创建的src
或RcppArmadillo.package.skeleton
文件夹中包含任何其他功能。
仅供参考,有关我的平台的相关信息是
答案 0 :(得分:7)
据我所知,roxygen2 issue ticket #771是我于8月3日提交的,但仍未解决。尽管roxygen2
小组已将其关闭。请随时跟进。
如果使用 roxygen2 6.0.1 ,它会起作用:
edd@rob:/tmp$ r -lRcppArmadillo -e'RcppArmadillo.package.skeleton(name = "prac_181206", example_code = FALSE)'
Calling kitten to create basic package.
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './prac_181206/Read-and-delete-me'.
Adding pkgKitten overrides.
Deleted 'Read-and-delete-me'.
Done.
Consider reading the documentation for all the packaging details.
A good start is the 'Writing R Extensions' manual.
And run 'R CMD check'. Run it frequently. And think of those kittens.
Adding RcppArmadillo settings
>> added Imports: Rcpp
>> added LinkingTo: Rcpp, RcppArmadillo
>> added useDynLib and importFrom directives to NAMESPACE
>> added Makevars file with Rcpp settings
>> added Makevars.win file with RcppArmadillo settings
edd@rob:/tmp$ cd prac_181206/
edd@rob:/tmp/prac_181206$ roxy.r
** Using cached version 6.0.1 of roxygen2.
First time using roxygen2. Upgrading automatically...
Updating roxygen version in /tmp/prac_181206/DESCRIPTION
Loading required package: Rcpp
edd@rob:/tmp/prac_181206$
其中roxy.r
是this simple wrapper,表示硬线 roxygen2 6.0.1
。