Writing the following R-Markdown chunk at the beginning of an R-Markdown file allows me to wrap a line in R-Markdown PDF output, provided that the R package formatR
is installed and the line to wrap has a whitespace character. How do I wrap a line if the line does not have a whitespace character?
```{r, echo = FALSE}
library(knitr)
opts_chunk$set(tidy.opts = list(width.cutoff = 27), tidy=TRUE)
```
For example, the following R chunk demonstrates failure to wrap and wrapping after 27 characters.
```{r, eval=TRUE, echo=TRUE, results="show", message=FALSE}
# devtools::install_github("tslever/Tom_Levers_Git_Repository/TomLeversRPackage")
# devtools::install_github( "tslever/Tom_Levers_Git_Repository/TomLeversRPackage")
```
I would like the first command to render as
# devtools::install_github(
"tslever/Tom_Levers_Git_Rep
ository/TomLeversRPackage")
Possibly another question: With the above options, the following R chunk is rendered as one line. How do I prevent this reformatting, and still wrap after 27 characters?
```{r, eval=TRUE, echo=TRUE, results="show", message=FALSE}
test.data.frame <- read.csv(
file = "C:/Users/Tom/Documents/Tom_Levers_Git_Repository/test.csv"
)
```