在R Markdown中将输出相邻放置

时间:2016-04-09 15:51:09

标签: r matrix markdown

如何让R Markdown中的两个矩阵彼此相邻显示?

---
title: "Test"
output: 
  pdf_document: 
    latex_engine: xelatex
---

```{r}
a <- matrix(rexp(18, rate=.1), ncol=3)
b <- matrix(rexp(4, rate=.1), ncol=2)
print(a)
print(b)
```

收益率(因此高于彼此):

a <- matrix(rexp(18, rate=.1), ncol=3)
b <- matrix(rexp(4, rate=.1), ncol=2)
print(a)

## [,1] [,2] [,3]
## [1,] 6.034713 14.882553 31.177579
## [2,] 11.011486 8.991163 2.291942
## [3,] 8.329703 30.096870 1.215264
## [4,] 18.560846 19.846930 4.020519
## [5,] 22.563052 2.182901 2.538573
## [6,] 4.225677 8.603654 8.982184

print(b)

## [,1] [,2]
## [1,] 2.895999 1.859186
## [2,] 21.056651 27.426468

我正在寻找可以应用于此代码块的解决方案,而不是整个文档。

0 个答案:

没有答案