Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No vignettes found by browseVignettes where they actually are there

Tags:

r

devtools

I have a package on a github repository with 2 vignettes in the vignettes/ directory.

I tried to download if with devtools package like this

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

but when I try to browse Vignettes it appears they were not build.

> library(RTCGA)
> browseVignettes("RTCGA")
No vignettes found by browseVignettes("RTCGA")

I've seen some old issue where people suggested to use build_vignettes=TRUE, but as you see it didn't help OR to add move Vignettes to remove inst/doc/ directory from .Rbuildignore file. But this must be and old issue, because I haven't seen such directory in a binary source after installation of the package.

I've also seen this answer on a similar question, but when I built source and then install package from a source it appears to have the same issue: No vignettes found by browseVignettes("RTCGA").

Any idea on how to make this work?

EDIT

According to Martin's answer I've addedthis fragment of code to vignettes' YAML

vignette: >
  %\VignetteIndexEntry{Integrating TCGA Data - RTCGA Tutorial}
  %\VignetteEngine{knitr::rmarkdown}

I've edited YAML of 2 of my vignettes

  • I've added code to the beggining of YAML - this file
  • Just in case I once added new information to the end of YAML - this file

but still there appears there are no vignettes available after installation from 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")

EDIT 2

Of course I've forgoten to add parameter buildVignettes = TRUE but after this it looks like vignettes are seen but there is some problem with their compilation during build:

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)
like image 478
Marcin Kosiński Avatar asked Aug 23 '15 21:08

Marcin Kosiński


1 Answers

From Writing R Extensions, section 1.4.2, your vignettes need to have a line

%\VignetteEngine{knitr::knitr}

in them; a common paradigm is to add the following to the yaml at the top of the vignette

vignette: >
  %\VignetteIndexEntry{Integrating TCGA Data}
  %\VignetteEngine{knitr::rmarkdown}

VignetteIndexEntry provides a convenient title for R's help system. Remember the BiocStyle package for creating vignettes with a consistent look.

like image 181
Martin Morgan Avatar answered Nov 15 '22 21:11

Martin Morgan