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!
I had /inst/ and .git in my .Rbuildignore file. When I removed those two lines from .Rbuildignore the vignettes built properly.
I also found and followed all the problems Garini notes on a comment:
[.onLoad()][1]
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With