With Rmarkdown
, how could we do to get two chunk outputs side by side ?
I have naively tried this which doesn't work:
<div class="container-fluid">
<div class="row-fluid">
<div class="span4">
```{r one, eval=TRUE, echo=FALSE}
......
......
```
</div>
<div class="span4">
```{r two, eval=TRUE, echo=FALSE}
......
......
```
</div>
</div>
</div>
Actually, more precisely, I want to generate two figures side by side. I know this is possible with only one figure using mfrow()
for classical plots or grid.arrange()
for ggplots, but I'd like to include two html legends, one below each figure.
NB: I'm rather ignorant in HTML.
To place multiple figures side-by-side from the same code chunk, you can use the fig. show='hold' option along with the out. width option. Figure 2.5 shows an example with two plots, each with a width of 50% .
You can insert an R code chunk either using the RStudio toolbar (the Insert button) or the keyboard shortcut Ctrl + Alt + I ( Cmd + Option + I on macOS).
I found a similar question that provides some possible code solutions and a link to the Docco standard style, which shows a nice example:
2 Column Report in R Markdown - Render HTML aside Data Frame
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With