25.7 SweaveOpts Undefined

20200602 Be sure to select knitr under . If you have initially run your document using Sweave rather than knitr (Xie 2021) (RStudio defaults to Sweave) and then attempt to change to knitr (Xie 2021), you may find the following error:

! Undefined control sequence.
l.54 \SweaveOpts
                {concordance=TRUE}
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")

RStudio 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 (Xie 2021).

References

———. 2021. Knitr: A General-Purpose Package for Dynamic Report Generation in r. https://yihui.org/knitr/.


Your donation will support ongoing development and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.