Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go


SweaveOpts Undefined

20200602 Be sure to select knitr under Tools $\rightarrow$ Global Options $\rightarrow$ Sweave $\rightarrow$ Weave Rnw files using:. If you have initially run your document using Sweave rather than knitr (RStudio defaults to Sweave) and then attempt to change to knitr, you may find the following Undefined control sequence error:

! Undefined control sequence.
l.54 \SweaveOpts
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

We will find this error message towards the end of the log file obtained by clicking the View Log button. A popup will also tell us that we can convert the file using Sweave2knitr("report.Rnw")

has automatically inserted a required line for compiling with Sweave. As the error message suggests, go to the line containing the undefined sequence (line 54 is noted in this instance, but that is in the automatically generated .tex file rather than the source .Rnw file that we are editting so we will need to search for the string) and delete the offending LaTeX control sequence and the bracketed argument. It should then run just fine in knitr.

Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.