Change size of R output in RMarkdown
Asked Answered
M

1

6

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.

Mote answered 8/7, 2018 at 7:17 Comment(3)
Something like this? r.789695.n4.nabble.com/rmarkdown-and-font-size-td4736865.htmlFernferna
I've been trying to change many of these style options, but neither of them seems to work.Mote
@Mote Could you give me please some feedback whether my answer below has solved your problem?Gerdes
G
13

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

Gerdes answered 8/7, 2018 at 9:26 Comment(2)
This doesn't seem to work with output:powerpoint_presentation. Any idea for that?Suasion
@drj3122 Since I don't work with MS office I have no clue. What I know is that power point doesn't use LaTeX. You could ask this as a new question and refer to this one.Gerdes

© 2022 - 2024 — McMap. All rights reserved.