[Rd] "R CMD Sweave --driver=..." woes

Vincent Goulet v|ncent@gou|et @end|ng |rom me@com
Fri Jun 26 06:01:28 CEST 2020

In trying to change the driver used by Sweave on the command line using 

   R CMD Sweave --driver=foo

I consistently get the "directory 'foo' does not exist' error. (For any value of 'foo', even the default 'RweaveLatex'.)

Looking up the source code for function .Sweave that is called by 'R CMD Sweave', I notice that the argument 'driver', if used, is added to the vector of arguments of ''buildVignette' without being named. It ends up being passed to argument 'dir', hence rhe error.

I believe the simple patch below should fix the issue, but I wasn't able to test it.

Hope this helps.


Vincent Goulet
Professeur titulaire
École d'actuariat, Université Laval

Index: src/library/utils/R/Sweave.R
--- src/library/utils/R/Sweave.R	(revision 78746)
+++ src/library/utils/R/Sweave.R	(working copy)
@@ -516,7 +516,7 @@
    args <- list(file=file, tangle=FALSE, latex=toPDF, engine=engine, clean=clean)
-    if(nzchar(driver)) args <- c(args, driver)
+    if(nzchar(driver)) args <- c(args, driver=driver)
    args <- c(args, encoding = encoding)
    if(nzchar(options)) {
        opts <- eval(str2expression(paste0("list(", options, ")")))

More information about the R-devel mailing list