【发布时间】:2022-01-12 22:50:01
【问题描述】:
我正在开发一个使用本地存储包的依赖项的 R 包,但我无法弄清楚如何在 DESCRIPTION 文件中正确列出该包。我正在构建的包是 PackageA,它依赖于 PackageB。在我从同事那里共享了 PackageB 的 zip 文件夹后,PackageB 本地存储在我的驱动器上。这两个软件包仅供内部使用,不会存储在任何存储库中。我发现以下页面显示了如何使用DESCRIPTION 文件中的Remotes: 标记来完成此操作:
https://cran.r-project.org/web/packages/devtools/vignettes/dependencies.html
这可以用下面的代码来完成,但是当我尝试这个时,我收到一个错误,如下所示:
#Example from linked vignette
# Local
Remotes: local::/pkgs/testthat
#Both of these attempts produce the same error
#1. Specify file path to the unpacked version of the package in my R library
Remotes: local::C:/Users/name/library/PackageB
#2. Specify file path to the original .zip version of the package
Remotes: local::C:/Users/name/library/PackageB.zip
#devtools::build() error
ERROR: package installation failed
Error in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr:
E> * checking for file 'C:\Users\name\PackageA/DESCRIPTION' ... OK
E> * preparing 'PackageA':
E> * checking DESCRIPTION meta-information ... OK
E> * installing the package to build vignettes
E> -----------------------------------
E> ERROR: dependency 'PackageB' is not available for package 'PackageA'
E> * removing 'C:/Users/tmpfolder/PackageA'
E> -----------------------------------
E> ERROR: package installation failed
#Rstudio Install and Restart error; I would build the source after this but it doesn't get that far
Error: Dependency package(s) 'PackageB' not available.
Backtrace:
x
1. +-base::suppressPackageStartupMessages(...)
2. | \-base::withCallingHandlers(expr, packageStartupMessage = function(c) tryInvokeRestart("muffleMessage"))
3. \-devtools::document(...)
4. \-roxygen2::roxygenise(pkg$path, roclets)
5. \-roxygen2:::load_code(base_path)
6. \-pkgload::load_all(path, helpers = FALSE, attach_testthat = FALSE)
7. \-pkgload:::load_imports(path)
8. \-pkgload:::abort_for_missing_packages(res, imports$package)
Warning message:
In (function (dep_name, dep_ver = "*") :
Dependency package 'PackageB' not available.
Execution halted
Exited with status 1.
我想知道我是否错误地指定了文件路径,但也许它更复杂。
【问题讨论】:
标签: r package devtools roxygen2