[Rd] SweaveParseOptions, quoted commas, and knitr vignettes

Ben Bolker bbolker at gmail.com
Wed Jul 17 04:34:33 CEST 2013

  I haven't figured it out entirely, but it looks like there are a
couple of small glitches with knitr-based vignettes and

  I posted the tarball of a package with a knitr vignette with (as far
as I can tell) everything properly coded in the DESCRIPTION file
(VignetteBuilder: knitr, Suggests: knitr) and the vignette itself
(%\VignetteEngine{knitr::knitr}).  When Windows users (who may not
have had knitr installed) tried to install it from source, they
encountered an error from utils:::SweaveParseOptions .
  The proximal source of the problem was a chunk header of the form
<<chunkName,fig.cap="Something with a comma in it, ...">>= ; this is
legal knitr, but doesn't make it through SweaveParseOptions because
the function just splits on a comma without trying to check for
nesting within quotation marks.
  The second problem is that for some reason SweaveParseOptions was
being called at all -- presumably it's looking at Rnw files, not
knowing that they're really in knitr rather than Sweave format.

  I'm sorry for the speculation and lack of reproducible examples
here, but I thought it was worth commenting on.  If people are
interested I can try to follow it up with a mini-package (one of the
hard parts is that I can't actually reproduce the error myself -- I
don't know if it's specific to Windows, or to not having knitr
installed, or both ...)

  Ben Bolker

More information about the R-devel mailing list