I am building an R package.
==> devtools::document(roclets = c('rd', 'collate', 'namespace', 'vignette'))
Updating package documentation
Writing NAMESPACE
Loading package
.
.
.
Writing NAMESPACE
Updating vignettes
Rebuilding projectR.Rmd
I get the following error after this
Error in if (idx > 0) sprintf("default-%s.tex", template_versions[idx]) else "default.tex" :
missing value where TRUE/FALSE needed
Calls: suppressPackageStartupMessages ... create_output_format -> do.call -> <Anonymous> -> create_latex_template
Execution halted
Exited with status 1.
I am not sure what is causing the error. I thought because it calls roxygen2::roxygenize, it may be originating from there but the package doesn't contain this error message. Can someone please guide me in resolving this?
You are getting this error from a bug in older versions of BiocStyle
. As part of the vignette processing in the version you have, the following line is run:
idx <- match(TRUE, version >= template_versions)
However, if version >= template_versions
returns NA
, then idx
will also be NA
. Then the if (idx > 0)
check throws the error you got.
You can see the commit where they fixed this bug here, by changing the above line to
idx <- match(TRUE, version >= template_versions, nomatch = 0)
So, you need version 2.13.1 or later to avoid this bug. One way to do that could be to install from GitHub:
library(devtools)
install_github("Bioconductor/BiocStyle")