RcppArmadillo.package.skeleton 创建的 NAMESPACE 选项导致错误
NAMESPACE option created by RcppArmadillo.package.skeleton causes error
我正在创建一个 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()
花了一些时间后,我发现这可以通过删除 NAMESPACE
文件中的 .registration
选项来解决,如下所示。
原始命名空间文件
useDynLib(prac_181206, .registration=TRUE)
importFrom(Rcpp, evalCpp)
exportPattern("^[[:alpha:]]+")
简而言之,将上面的第一行更改为useDynLib(prac_181206)
后,它工作正常,但我不明白错误的含义以及我的解决方案为何有效。
有人能帮我解决这件事吗?我很感激!
因为这是一个玩具示例,希望可以重现,所以我没有在上面 RcppArmadillo.package.skeleton
创建的 man
或 src
文件夹中包含任何其他函数。
仅供参考,关于我的平台的相关信息是
- Windows 7 x64
- R-3.5.1, Rstudio-1.1.423
- Rcpp-0.12.19, RcppArmadillo-0.9.100.5.0
- roxygen2-6.1.1
也就是说,据我所知,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
.
我正在创建一个 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()
花了一些时间后,我发现这可以通过删除 NAMESPACE
文件中的 .registration
选项来解决,如下所示。
原始命名空间文件
useDynLib(prac_181206, .registration=TRUE)
importFrom(Rcpp, evalCpp)
exportPattern("^[[:alpha:]]+")
简而言之,将上面的第一行更改为useDynLib(prac_181206)
后,它工作正常,但我不明白错误的含义以及我的解决方案为何有效。
有人能帮我解决这件事吗?我很感激!
因为这是一个玩具示例,希望可以重现,所以我没有在上面 RcppArmadillo.package.skeleton
创建的 man
或 src
文件夹中包含任何其他函数。
仅供参考,关于我的平台的相关信息是
- Windows 7 x64
- R-3.5.1, Rstudio-1.1.423
- Rcpp-0.12.19, RcppArmadillo-0.9.100.5.0
- roxygen2-6.1.1
也就是说,据我所知,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
.