[Rd] Problem building rmarkdown vignettes with child

Witold E Wolski wewol@ki @ending from gm@il@com
Fri Sep 14 09:22:20 CEST 2018


Dear Community,

I have an Rmarkdown vignette with optional child documents.
Since all markdown files in the vingette folder are build when
executing R CMD build
I did place the child documents in
/inst/ParametrizedReportChid/
so they are excluded from the build.

I do reference them from the markdown file in the vignette folder by:

```{r referencingChildDocument}
child_docs <- "Grp2Analysis_MissingInOneCondtion.Rmd"
if(!sum(NAinfo$nrProteins > 0) > 0){
  child_docs <- "Grp2Analysis_Empty.Rmd"
}
child_docs <- system.file("ParametrizedReportsChild",child_docs,package
= "SRMService")
```

```{r includeMissingInOne, child = child_docs}
```

When running
devtools::clean_vignettes()
devtools::build_vingettes()
devtools::build() # or R CMD build PACKAGE

all works fine. However,

devtools::clean_vignettes()
devtools::build() # or R CMD build PACKAGE

Fails with the diagnostic:

** building package indices
** installing vignettes
   ‘Grp2Analysis.Rmd’ using ‘UTF-8’
Error in eval(x, envir = envir) : object 'child_docs' not found
Warning in readLines(if (is.character(input2)) { :
  cannot open file './child_docs': No such file or directory
Quitting from lines 387-388 (./child_docs)
Error in readLines(if (is.character(input2)) { :
  cannot open the connection
ERROR: installing vignettes failed

I did try to use the base::system.file and devtools::system.file
function but both generate the same error.

The package and vignette can be found here:
https://github.com/protviz/SRMService


Have a great day

Best regards
Witek



-- 
Witold Eryk Wolski



More information about the R-devel mailing list