Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing package fails when building vignettes ((..)/doc/index.html is missing)

I'm creating an R package with a vignette. However, when I try to install the package by using

 devtools::install(build_vignettes = TRUE)

an error occurs since it cannot find the file index.html in the doc folder. I thought this file would be automatically created, but apperently something goes wrong here. The error occuring is the following:

"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore  \
--quiet CMD INSTALL "C:/Users/lnab/AppData/Local/Temp/Rtmpi0XLJ4/mecor_0.1.0.tar.gz"  \
--library="\\vf-d2-home/d2home$/lnab/MyDocs/R/win-library/3.4" --install-tests 

* installing *source* package 'mecor' ...
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
converting help for package 'mecor'
finding HTML links ... done
mecor-package                           html  
uaetrial                                html  
uaetrial_cal                            html  
** building package indices
** installing vignettes
Warning in file(con, "w") :
cannot open file '\\vf-d2-home/d2home$/lnab/MyDocs/R/win-library/3.4/mecor/doc/index.html': No such file or directory
Error in file(con, "w") : cannot open the connection
ERROR: installing vignettes failed
* removing '\\vf-d2-home/d2home$/lnab/MyDocs/R/win-library/3.4/mecor'
* restoring previous '\\vf-d2-home/d2home$/lnab/MyDocs/R/win-library/3.4/mecor'
In R CMD INSTALL

My vignette .Rmd looks like this:

---
title: "Introduction to mecor"
author: "Linda Nab"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Introduction to mecor}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---  

I never build an R package before but search the internet for a solution for this problem for days but cannot find any. This seems to be the same problem but I cannot find the solution for the problem there. You can find my package here.

Really hope someone could help me!

like image 626
Linda Nab Avatar asked Jan 09 '18 14:01

Linda Nab


3 Answers

I had /inst/ and .git in my .Rbuildignore file. When I removed those two lines from .Rbuildignore the vignettes built properly.

like image 110
katiesaund Avatar answered Nov 04 '22 12:11

katiesaund


I also found and followed all the problems Garini notes on a comment:

  1. Reverse the .gitignore as it was before the bug
  2. This: [.onLoad()][1]
  3. This: Hadley ..Rcheck

What worked for me was to check for other folders and files on the directory of the package and remove or ignore at building those folders that are not standard for an R package, for a summary of them see the index of R packages. This is on line with the Hadley proposed solution. Maybe is a folder or file created by the vignette or while developing the package.

In my case I had a build folder I didn't realize it was there.

like image 27
llrs Avatar answered Nov 04 '22 11:11

llrs


It took me a few days, but in my case it worked once I removed a folder called "build". I am happy now! Previously, my check worked but not my install.

like image 1
Ysabel Avatar answered Nov 04 '22 12:11

Ysabel