ajsims1704 / rdecision

Decision Analytic Modelling In Health Economics
1 stars 0 forks source link

Vignette building fails with R CMD check without --as-cran. #16

Open ajsims1704 opened 3 weeks ago

ajsims1704 commented 3 weeks ago

R CMD check appears to copy vignette .Rmd files to the 'inst/doc' folder and use that as the build folder before building them, whereas R CMD build appears to build them from the 'vignettes' folder directly, and R CMD check --as-cran does not appear to rebuild them at all. The function check() of the devtools package appears to build vignettes from the 'vignettes' folder.

Because the vignettes in rdecision refer to files elsewhere in the package structure, mostly in tests/testthat to avoid code repetition, they fail to build if the build folder is not 'vignettes', including R CMD check, because the external files are loaded with a relative path. The required fix is to add code to the vignette preamble to find the relative path to the package root folder, from which to reference external files.