[Rd] Problem building rmarkdown vignettes with child
Duncan Murdoch
murdoch@dunc@n @ending from gm@il@com
Fri Sep 14 11:19:35 CEST 2018
On 14/09/2018 3:22 AM, Witold E Wolski wrote:
> 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
This message makes it look as though it is looking for an R object named
child_docs and not finding it.
> Warning in readLines(if (is.character(input2)) { :
> cannot open file './child_docs': No such file or directory
This message makes it look as though it thinks "child_docs" is the
filename, not a variable holding the filename.
> Quitting from lines 387-388 (./child_docs)
This one looks like it's a filename again.
It's a long vignette, and not easy to spot where things are going wrong.
I'd recommend backing up the original, and just cutting things out
until the only thing left is the error. Hopefully then it will be clear
what's wrong.
Duncan Murdoch
> 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
More information about the R-devel
mailing list