gpt4 book ai didi

r - 尝试使用 install_github 安装小插图时无法构建包 [R]

转载 作者:行者123 更新时间:2023-12-02 17:20:46 25 4
gpt4 key购买 nike

默认情况下,当使用 R 中的 devtools 包中的 install_github 函数时,不会构建已安装包的小插图。我已经看到这个问题的答案,它展示了如果有人愿意的话如何构建小插图 Building R package from github: how to disable building vignettes? .

我用such vignettes写了一个包但我收到一个错误,直接从 github 安装,如下所示:

> devtools::install_github("MarcinKosinski/RTCGA")
Downloading github repo MarcinKosinski/RTCGA@master
Installing RTCGA
'/usr/lib/R/bin/R' --vanilla CMD INSTALL \
'/tmp/RtmpCIboSY/devtools17de96523e5/MarcinKosinski-RTCGA-e47bdf6' \
--library='/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2' \
--install-tests

* installing *source* package ‘RTCGA’ ...
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RTCGA)
> browseVignettes("RTCGA")
No vignettes found by browseVignettes("RTCGA")
> ?devtools::install_github
> devtools::install_github("MarcinKosinski/RTCGA", build_vignettes= TRUE)
Downloading github repo MarcinKosinski/RTCGA@master
Installing RTCGA
'/usr/lib/R/bin/R' --vanilla CMD build \
'/tmp/RtmpCIboSY/devtools17de1905fc71/MarcinKosinski-RTCGA-e47bdf6' \
--no-resave-data --no-manual

* checking for file ‘/tmp/RtmpCIboSY/devtools17de1905fc71/MarcinKosinski-RTCGA-e47bdf6/DESCRIPTION’ ... OK
* preparing ‘RTCGA’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
Removed empty directory ‘RTCGA/ghPage’
Removed empty directory ‘RTCGA/inst’
* building ‘RTCGA_0.99.6.tar.gz’

'/usr/lib/R/bin/R' --vanilla CMD INSTALL \
'/tmp/RtmpCIboSY/RTCGA_0.99.6.tar.gz' \
--library='/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2' \
--install-tests

* installing *source* package ‘RTCGA’ ...
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
Warning in file(con, "w") :
cannot open file '/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA/doc/index.html': No such file or directory
Error in file(con, "w") : cannot open the connection
ERROR: installing vignettes failed
* removing ‘/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA’
* restoring previous ‘/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA’
Error: Command failed (1)

当我在本地从源代码构建包时,没有错误。谁能知道这可能是什么原因造成的?

最佳答案

我需要添加

.onLoad <- function(libname, pkgname) {
vig_list = tools::vignetteEngine(package = 'knitr')
vweave <- vig_list[['knitr::knitr']][c('weave')][[1]]
vtangle <- vig_list[['knitr::knitr']][c('tangle')][[1]]
tools::vignetteEngine(pkgname, weave = vweave, tangle = vtangle,
pattern = "[.]Rmd$", package = pkgname)
#register_vignette_engines(pkgname)
}

将此函数复制到 R/ 目录中的 zzz.R 文件,并将 knitr 打包到 DESCRIPTION 文件中的依赖项.

关于r - 尝试使用 install_github 安装小插图时无法构建包 [R],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32286610/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com