Side by Side xtable and plot in rmarkdown html

Viewed 365

I'm trying to have a table and a plot side by side in an rmarkdown html file but I can't figure out how to do it. I found this post https://gist.github.com/jennybc/e9e9aba6ba18c72cec26#file-2015-03-02_plot-next-to-table-rmd but its not working (i have no idea of how to use css code).

This is a toy example:

---
title: "Toy"
output: 
  html_document:
    theme: journal
---

<style type="text/css">
.twoC {width: 100%}
.clearer {clear: both}
.twoC .table {max-width: 50%; float: right}
.twoC img {max-width: 50%; float: left}
</style>


```{r, echo=FALSE}
library(xtable)
```

<div class="twoC">
```{r ,echo = FALSE,results="asis"}
print(xtable(head(cars)),comment=F,floating = T,type = "html")
```


```{r pressure, echo=FALSE} 
plot(pressure)
```
</div>
<div class="clearer"></div>
0 Answers
Related