rbuildpackagerstudiosweave

R refers to non exisiting files during R CMD check


I want to R CMD check with RStudio my package (for this question I call it pkg). But I get the following error message:

* preparing 'pkg':
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ...Error in find_vignette_product(name, by = "weave", dir = docdir, engine = engine) : 
  Failed to locate the 'weave' output file (by engine 'utils::Sweave') for vignette with name 'my-vignette'. The following files exist in directory 'C:/Users/name/AppData/Local/Temp/RtmpQLnSjE/Rbuild244434d45c05/pkg/vignettes': 'my-vignette.R', 'my-vignette.Rmd'
Execution halted
Error: Command failed (1)
In addition: Warning message:
`cleanup` is deprecated 
Execution halted

Exited with status 1.

One first thing, where something might got wrong is that there is no folder called RtmpQLnSjE in my C:/Users/name/AppData/Local/Temp/ directory. Running my Rmd file by hand, does not generate any errors.

I update RStudio to the latest version 1.1.423 and this is my SessionInfo():

R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C                    LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] MCMCglmm_2.25 ape_5.0       coda_0.19-1   lme4_1.1-15   Rcpp_0.12.15  Matrix_1.2-12 hmi_0.9.4    

loaded via a namespace (and not attached):
 [1] lattice_0.20-35 corpcor_1.6.9   digest_0.6.15   withr_2.1.1     MASS_7.3-48     grid_3.4.3     
 [7] nlme_3.1-131    cubature_1.3-11 minqa_1.2.4     nloptr_1.0.4    devtools_1.13.4 splines_3.4.3  
[13] tools_3.4.3     yaml_2.1.16     parallel_3.4.3  compiler_3.4.3  memoise_1.1.0   tensorA_0.36 

Solution

  • Concluding as an answer:

    Failed to locate the 'weave' output file

    This error can have several root causes and is not always easy to trace down. However, there is a good chance that it is related to code inside the vignette, in particular code navigating directories and such (e.g. setwd() or other functions that may rely on relative paths that could differ between a stand-alone run and the more involved R CMD check)