尝试使用install_github [R]安装晕影时无法构建程序包

时间:2015-08-29 13:32:02

标签: r devtools

默认情况下,如果在R中使用install_github包中的devtools函数,则不会构建已安装包的插图。我已经看到了这个问题,答案显示了如果想要的话如何建立小插曲 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)

当我从源本地构建包时,没有错误。任何人都可以知道这可能是什么原因吗?

1 个答案:

答案 0 :(得分:3)

我需要添加

.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文件中的依赖项。