并排xtable并在rmarkdown html中打印

并排xtable并在rmarkdown html中打印,r,r-markdown,R,R Markdown,我试图在rmarkdownhtml文件中并排拥有一个表和一个绘图,但我不知道如何做到这一点。我找到了这篇文章,但它不起作用(我不知道如何使用css代码) 这是一个玩具示例: --- title: "Toy" output: html_document: theme: journal --- <style type="text/css"> .twoC {width: 100%} .clearer {clear: both} .twoC .table {max-width

我试图在
rmarkdown
html文件中并排拥有一个表和一个绘图,但我不知道如何做到这一点。我找到了这篇文章,但它不起作用(我不知道如何使用css代码)

这是一个玩具示例:

---
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>
---
标题:“玩具”
输出:
html_文件:
主题:期刊
---
.twoC{宽度:100%}
.clear{clear:两个}
.twoC.表{最大宽度:50%;浮点值:右}
.twoC img{最大宽度:50%;浮动:左}
```{r,echo=FALSE}
图书馆(xtable)
```
```{r,echo=FALSE,results=“asis”}
打印(xtable(head(cars)),comment=F,floating=T,type=“html”)
```
```{r压力,回波=假}
绘图(压力)
```