我在vignettes/
目录中有一个带有2个小插图的package on a github repository。
我尝试下载像这样的devtools
包
> if (!require(devtools)) {
+ install.packages("devtools")
+ require(devtools)
+ }
> install_github("MarcinKosinski/RTCGA", build_vignettes=TRUE)
Downloading github repo MarcinKosinski/RTCGA@master
Installing RTCGA
"D:/R-32~1.2/bin/x64/R" --no-site-file --no-environ --no-save --no-restore CMD INSTALL \
"C:/Users/Marcin/AppData/Local/Temp/Rtmpg1Kbfy/devtools3cf47f1f6731/MarcinKosinski-RTCGA-0d91d7c" \
--library="C:/Users/Marcin/Documents/R/win-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)
Reloading installed RTCGA
Welcome to the RTCGA (version: 0.99.6).
但是,当我尝试浏览Vignettes时,似乎没有构建它们。
> library(RTCGA)
> browseVignettes("RTCGA")
No vignettes found by browseVignettes("RTCGA")
我见过有人建议使用
build_vignettes=TRUE
的some old issue,但是如您所见,它没有帮助或添加移动小插图以从inst/doc/
文件中删除.Rbuildignore
目录。但这一定是老问题了,因为安装软件包后,在二进制源文件中我还没有看到这样的目录。我也曾在类似的问题上看到过this answer,但是当我构建源代码然后从源代码安装软件包时,似乎出现了相同的问题:
No vignettes found by browseVignettes("RTCGA")
。关于如何进行这项工作的任何想法吗?
编辑
根据马丁的回答
我已将此代码片段添加到小插图的YAML中
vignette: >
%\VignetteIndexEntry{Integrating TCGA Data - RTCGA Tutorial}
%\VignetteEngine{knitr::rmarkdown}
我已经编辑了两个小插图的YAML
但是仍然存在从github安装后没有可用的小插曲
> devtools::install_github("MarcinKosinski/RTCGA")
Downloading github repo MarcinKosinski/RTCGA@master
Installing RTCGA
'/usr/lib/R/bin/R' --vanilla CMD INSTALL \
'/tmp/Rtmpk34Zbr/devtools531845716f54/MarcinKosinski-RTCGA-5571117' \
--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)
> library(RTCGA)
Welcome to the RTCGA (version: 0.99.6).
> browseVignettes("RTCGA")
No vignettes found by browseVignettes("RTCGA")
编辑2
当然,我已经放弃添加参数
buildVignettes = TRUE
了,但是在此之后似乎可以看到小插图,但是在构建过程中它们的编译存在一些问题: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/RtmpA7il1Q/devtools5fc871b48f57/MarcinKosinski-RTCGA-e47bdf6' \
--no-resave-data --no-manual
* checking for file ‘/tmp/RtmpA7il1Q/devtools5fc871b48f57/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/RtmpA7il1Q/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)
最佳答案
在Writing R Extensions的1.4.2部分中,您的小插曲需要有一行
%\VignetteEngine{knitr::knitr}
在他们之中;常见的范例是将以下内容添加到小插图顶部的yaml中
vignette: >
%\VignetteIndexEntry{Integrating TCGA Data}
%\VignetteEngine{knitr::rmarkdown}
VignetteIndexEntry为R的帮助系统提供了一个方便的标题。记住BiocStyle软件包,用于创建外观一致的小插图。