I'm writing some course material using Rmarkdown and the tufte package. However, some of the R outputs I'd like to have in the document have a width larger than the width of the handout (see the summary of a lm model in the example below). I cannot manage to make these R outputs occupy the full width of the page (I'd like to have something similar to the fig.fullwidth chunk argument for figures).
I know there is a fullwidth environment but it having a R chunk inside this environment prevents pandoc to build the pdf due to the leading hashes in front of R output (Removing these hashes by specifying the chunk argument comment=NA produce a pdf but the formatting of the R output is lost).
Is there a way to have R output fullwidth ?
Thanks for help.
Below is a minimal example
---
title: "My minimal example"
link-citations: yes
output:
tufte::tufte_handout:
latex_engine: xelatex
---
```{r setup, include=FALSE}
library(tufte)
# invalidate cache when the tufte version changes
knitr::opts_chunk$set(tidy = FALSE, cache.extra =
packageVersion('tufte'))
options(htmltools.dir.version = FALSE)
```
This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.
```{r lm}
model = lm(dist~speed,data=cars)
summary(model)
```
\begin{fullwidth}
This is a fullwidth. paragraph. This is a fullwidth. paragraph. This is a fullwidth. paragraph. This is a fullwidth. paragraph. This is a fullwidth. paragraph. This is a fullwidth. paragraph. This is a fullwidth. paragraph. This is a fullwidth. paragraph. This is a fullwidth. paragraph. This is a fullwidth. paragraph.
\end{fullwidth}