如何在 R 包“DESCRIPTION”的“Remotes”字段中包含子目录

问题描述 投票:0回答:2

假设我想在我的 R 包中使用依赖项的开发版本,因为它位于某个 GitHub 分支上,但额外的复杂性是它驻留在子目录中。

例如,如果我想依赖此分支中的glmmTMB包,我可以使用

remotes
下载它,如下所示:

remotes::install_github("glmmTMB/glmmTMB@ci_tweaks", subdir = "glmmTMB")

如果这个包不是基于子目录,我可以在

DESCRIPTION
文件中包含以下内容:

Remotes: glmmTMB/glmmTMB@ci_tweaks

但是我不知道如何在这里指定子目录来获取包。

r r-package remotes
2个回答
1
投票

您应该知道遥控器会为您创建所有需要的描述文件字段。所以我运行

remotes::install_github("glmmTMB/glmmTMB@ci_tweaks", subdir = "glmmTMB")
,然后运行
packageDescription("glmmTMB")
。查看添加了多少个远程和 Github 连接的文件。有例如也
RemoteSubdir: glmmTMB

> packageDescription("glmmTMB")
Package: glmmTMB
Title: Generalized Linear Mixed Models using Template Model Builder
Version: 1.1.4
Authors@R: c(person("Mollie","Brooks", comment=c(ORCID="0000-0001-6963-8326"), role =
          c("aut", "cre"), email = "[email protected]"), person("Ben","Bolker",
          role="aut", comment=c(ORCID="0000-0002-2127-0443")),
          person("Kasper","Kristensen",role="aut"), person("Martin","Maechler", role="aut",
          comment=c(ORCID="0000-0002-8685-9910")), person("Arni","Magnusson", role="aut",
          comment=c(ORCID="0000-0003-2769-6741")), person("Maeve","McGillycuddy",
          role="ctb"), person("Hans","Skaug",role="aut"), person("Anders","Nielsen",
          role="aut", comment=c(ORCID="0000-0001-9683-9262")), person("Casper","Berg",
          role="aut", comment=c(ORCID="0000-0002-3812-5269")), person("Koen","van Bentham",
          role="aut"), person("Nafis","Sadat",role="ctb",
          comment=c(ORCID="0000-0001-5715-616X")), person("Daniel","Lüdecke", role="ctb",
          comment=c(ORCID="0000-0002-8895-3206")), person("Russ","Lenth", role="ctb"),
          person("Joseph", "O'Brien", role = "ctb", comment = c(ORCID =
          "0000-0001-9851-5077")), person("Charles J.","Geyer", role="ctb"),
          person("Mikael","Jagan", role="ctb", comment = c(ORCID = "0000-0002-3542-2938")),
          person("Brenton", "Wiernik", role="ctb", comment = c(ORCID =
          "0000-0001-9560-6336")) )
Description: Fit linear and generalized linear mixed models with various extensions,
          including zero-inflation. The models are fitted using maximum likelihood
          estimation via 'TMB' (Template Model Builder). Random effects are assumed to be
          Gaussian on the scale of the linear predictor and are integrated out using the
          Laplace approximation. Gradients are calculated using automatic differentiation.
License: AGPL-3
Depends: R (>= 3.2.0)
Imports: methods, TMB (>= 1.7.14), lme4 (>= 1.1-18.9000), Matrix, nlme, numDeriv
LinkingTo: TMB, RcppEigen
Suggests: knitr, rmarkdown, testthat, MASS, lattice, ggplot2 (>= 2.2.1), mlmRev, bbmle (>=
          1.0.19), pscl, coda, reshape2, car (>= 3.0.6), emmeans (>= 1.4), estimability,
          DHARMa, multcomp, MuMIn, effects (>= 4.0-1), dotwhisker, broom, broom.mixed, plyr,
          png, boot, texreg, xtable, huxtable, mvabund
SystemRequirements: GNU make
VignetteBuilder: knitr, rmarkdown
URL: https://github.com/glmmTMB/glmmTMB
LazyData: TRUE
BugReports: https://github.com/glmmTMB/glmmTMB/issues
NeedsCompilation: yes
Encoding: UTF-8
RoxygenNote: 7.1.2
RemoteType: github
RemoteHost: api.github.com
RemoteRepo: glmmTMB
RemoteUsername: glmmTMB
RemoteRef: ci_tweaks
RemoteSha: fd8bb78acd8b198147285ce94b1f67043349f570
RemoteSubdir: glmmTMB
GithubRepo: glmmTMB
GithubUsername: glmmTMB
GithubRef: ci_tweaks
GithubSHA1: fd8bb78acd8b198147285ce94b1f67043349f570
GithubSubdir: glmmTMB
Packaged: 2022-06-18 19:33:52 UTC; maciejnasinski
Author: Mollie Brooks [aut, cre] (<https://orcid.org/0000-0001-6963-8326>), Ben Bolker [aut]
          (<https://orcid.org/0000-0002-2127-0443>), Kasper Kristensen [aut], Martin
          Maechler [aut] (<https://orcid.org/0000-0002-8685-9910>), Arni Magnusson [aut]
          (<https://orcid.org/0000-0003-2769-6741>), Maeve McGillycuddy [ctb], Hans Skaug
          [aut], Anders Nielsen [aut] (<https://orcid.org/0000-0001-9683-9262>), Casper Berg
          [aut] (<https://orcid.org/0000-0002-3812-5269>), Koen van Bentham [aut], Nafis
          Sadat [ctb] (<https://orcid.org/0000-0001-5715-616X>), Daniel Lüdecke [ctb]
          (<https://orcid.org/0000-0002-8895-3206>), Russ Lenth [ctb], Joseph O'Brien [ctb]
          (<https://orcid.org/0000-0001-9851-5077>), Charles J. Geyer [ctb], Mikael Jagan
          [ctb] (<https://orcid.org/0000-0002-3542-2938>), Brenton Wiernik [ctb]
          (<https://orcid.org/0000-0001-9560-6336>)
Maintainer: Mollie Brooks <[email protected]>
Built: R 4.2.0; aarch64-apple-darwin20; 2022-06-18 19:33:53 UTC; unix

-- File: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/glmmTMB/Meta/package.rds

0
投票

Remotes
中打算从 GitHub 安装的条目可以采用以下一般形式

[<package>=][github::]<username>/<repository>[/<subdir>][<detail>]

对于此示例,

Remotes
字段中的条目应为
glmmTMB=github::glmmTMB/glmmTMB/glmmTMB@ci_tweaks
,并且
glmmTMB
应出现在
Depends
中(或类似的字段,例如
Suggests
)。

© www.soinside.com 2019 - 2024. All rights reserved.