Data Science Desktop Survival Guide by Graham Williams Desktop Survival Project Home Preface Data Science Introducing R R Constructs R Tasks R Strings R Read, Write, and Create Data Template Data Exploration Data Wrangling Data Visualisation Statistics ML Template ML Scenarios ML Activities ML Applications ML Algorithms Cluster Analysis Decision Trees Computer Vision Graph Data Privacy Literate Data Science Coding with Style Resources Bibliography Index

## SweaveOpts Undefined

20200602 Be sure to select knitr under Tools Global Options Sweave 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 {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")`

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.