knitr: How to prevent text wrapping in output?

Adding something like options(width=120) to your document would allow you to override the default wrapping width.

Be careful about going too wide though; when converting to PDF or other formats, the default is pretty much just right!

As an example, I use Knitr from RStudio, and type my document as a R markdown document. My document “options” at the start might be something like this:

```{r set-options, echo=FALSE, cache=FALSE}
options(width=80)
opts_chunk$set(comment = "", warning = FALSE, message = FALSE, echo = TRUE, tidy = TRUE, size="small")
read_chunk("some/script/I/want/to/load.R")
```

Leave a Comment