本文介绍了并排对齐多个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下代码在彼此之上产生2个表.我将如何设置以使其并排对齐,例如连续3个?
The following code produces 2 tables on top of each other. How would I set it to have them aligned side by side, e.g. 3 to a row?
---
title: "sample"
output: pdf_document
---
```{r global_options, R.options=knitr::opts_chunk$set(warning=FALSE, message=FALSE)}
```
```{r sample, echo=FALSE, results='asis'}
library(knitr)
t1 <- head(mtcars)[1:3]
t2 <- head(mtcars)[4:6]
print(kable(t1))
print(kable(t2))
```
输出看起来像这样:
Output looks like this:
推荐答案
只需将两个数据帧放入列表中,例如
Just put two data frames in a list, e.g.
t1 <- head(mtcars)[1:3]
t2 <- head(mtcars)[4:6]
knitr::kable(list(t1, t2))
请注意,这需要编织物> = 1.13.
Note this requires knitr >= 1.13.
这篇关于并排对齐多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!