尝试安装带有install_github的小片断时不能构建包[R]

时间:2023-01-18 07:24:57

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?.

默认情况下,当一个人在R中使用devtools包中的install_github函数时,安装包的小插图不是构建的。我已经看到了这个问题的答案,它展示了如果想要从github上构建R包,如何构建小插图:如何禁用小插图?

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

我用这样的小插图写了一个包,但是我收到了一个错误,从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)

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

当我从本地源代码构建包时,没有错误。有人知道是什么原因导致了这种情况吗?

1 个解决方案

#1


3  

I needed to add

我需要添加

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

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

这个函数打鼾声。R文件在R/目录和knitr包到依赖的描述文件。

#1


3  

I needed to add

我需要添加

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

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

这个函数打鼾声。R文件在R/目录和knitr包到依赖的描述文件。