尝试使用install_github安装小插图时无法构建软件包[R] [英] Fail to build package when trying to install vignettes with install_github [R]

查看:96
本文介绍了尝试使用install_github安装小插图时无法构建软件包[R]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,在R中使用 devtools 软件包中的 install_github 函数时,已安装软件包的插图不建立。我已经看过这个问题,并给出了答案,该答案显示了如果有人希望
从github构建R包:如何禁用构建小插图?

By default when one is using install_github function from devtools package in R the vignettes of the installed package are not build. I've seen this questio with an answer which shows how to build vignettes if one desires to Building R package from github: how to disable building vignettes?.

我用这样的小插曲,但我收到一个错误,直接从github安装是这样的:

I wrote a package with such vignettes and but I recieve an error what installing directly from github like this:

> 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)

当我从本地本地构建软件包时,没有错误。谁能知道这是什么原因吗?

When I build package from source locally there are no errors. Can anyone know what can be a cause of this?

推荐答案

我需要添加

.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)
}

此函数为 zzz.R 文件放在 R / 目录和 knitr 包中,以 DESCRIPTION中的依赖项文件。

this function to zzz.R file in R/ directory and knitr package to Dependencies in DESCRIPTION file.

这篇关于尝试使用install_github安装小插图时无法构建软件包[R]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆