10

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)
Community
  • 1
  • 1
Marcin
  • 7,834
  • 8
  • 52
  • 99
  • 1
    I have found the `R CMD build ...; R CMD INSTALL ...` sequence to be the most reliable for this. – Dirk Eddelbuettel Aug 23 '15 at 22:00
  • So the most reliable way is to download whole repository (if you are not the maintainer). Then unpack it. Then go `R CMD build`, then do `R CMD INSTALL`? That may be really uncomfortable for semi-advanced R users. I hoped 1 line with `install_github()` would be enough.. – Marcin Aug 23 '15 at 22:36
  • 2
    Maybe or maybe not. I happen to think that `install_github()` has a number of issues, and this may be yet another one. If someone plans to distribute software they should use a repository. If you plan to install RTCGA more than once, maybe you should have it on a repository. [drat](http://dirk.eddelbuettel.com/code/drat.html) helps a lot in both creating and then deploying from a repository. – Dirk Eddelbuettel Aug 23 '15 at 23:04
  • Thanks @DirkEddelbuettel for help. I'm planning to publish this package on bioconductor. Maybe one day I'll use drat :) – Marcin Aug 23 '15 at 23:29

2 Answers2

7

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.

Martin Morgan
  • 45,935
  • 7
  • 84
  • 112
  • Ah yes, having a `VignetteEntry{}` linely surely helps :) Also nice work with [BiocStyle](https://bioconductor.org/packages/BiocStyle) which I was unaware of. What is the minimum size of a html vignette written with it (comparing to the ~ 10k using [rarticles](https://github.com/rstudio/rticles) versus well over 100k via the standard rmarkdown file). – Dirk Eddelbuettel Aug 24 '15 at 02:40
  • @DirkEddelbuettel we (Andrzej has contributed most, especially to markdown) really looked at size; BiocStyle.html is about 92k; the similar (information content wise) LatexStyle.pdf is 160k – Martin Morgan Aug 24 '15 at 04:31
  • Hey Martin - I've edited my question. Thanks for good suggestion. I used your suggestion and edited YAML but there is stil problem with vignettes that are not seen :/ – Marcin Aug 26 '15 at 11:49
  • 2
    @MarcinKosinski did you remember to `build_vignettes=TRUE`? (R complains about the vignette being 'non-ASCII'; use `tools::showNonASCIIfile()` to spot the non-ascii hyphen in reference 5). – Martin Morgan Aug 26 '15 at 15:10
  • @MartinMorgan ok the vignettes are being build. All is fine. Now I'm having an issue with that that they can not be build (I've EDITED my question the second time) but il looks like a problem for a new question on SO. Thanks for help – Marcin Aug 26 '15 at 16:03
0

I only could solve this, using:

devtools::build_vignettes()

Of course, then uploading the new files by git

Ferroao
  • 3,042
  • 28
  • 53