Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change size of R output in RMarkdown

I'm preparing a beamer presentation using RMarkdown and want to include lm output in it. However the default size is too large, therefore the output is clipped and can't be seen entirely. How can I change the options to control the size (or font) of R output? I have seen plenty of options regarding size of plots, but none with regards to R output.

like image 368
jakes Avatar asked Dec 24 '22 06:12

jakes


1 Answers

Rmarkdown's beamer presentation works with LaTeX code. To change the output size you can use the corresponding LaTeX commands, set just before the code junk. The smallest option would be \tiny. For a full overview consider e.g. this. After the code junk it's important to set back to the size you used before, e.g. \normalsize.

Example

---
output: beamer_presentation
---

# Regression
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy 
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

\tiny
```{r cars, echo = TRUE}
summary(lm(speed ~ dist, cars))
```

\normalsize
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy 
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

Yielding

enter image description here

like image 123
jay.sf Avatar answered Dec 31 '22 13:12

jay.sf