我正在尝试在markdown文档中打印多个x表,其中包含一些文本。但是,输出pdf不具有我指定的顺序的表。我附上了
下面的示例代码和输出 ---
title: "Table Test"
author: "Nishant"
date: "December 15, 2015"
output: pdf_document
---
#XYZ Factor correlation
```{r,echo=FALSE,warning=FALSE,message=FALSE,results='asis',fig.pos='H'}
library(xtable)
options(xtable.comment = FALSE)
R.Name = c('Europe','North.America','Pacific')
x= array(0, dim = c(3,3))
colnames(x) = R.Name
rownames(x) = R.Name
print.xtable(xtable(x))
print.xtable(xtable(x))
print.xtable(xtable(x))
print.xtable(xtable(x))
print.xtable(xtable(x))
print.xtable(xtable(x))
```
\pagebreak
#XYZ Neutralized Factor Correlation
We next present the results for neutralized factor returns. Specifically we present the correlations of the residuals of factor returns after regressing them against the global variants of each of the factor and the market. We exclude the global variant of the factor in question
```{r,echo=FALSE,warning=FALSE,message=FALSE,results='asis',fig.pos='H'}
x= array(0, dim = c(3,3))
print.xtable(xtable(x))
print.xtable(xtable(x))
print.xtable(xtable(x))
print.xtable(xtable(x))
print.xtable(xtable(x))
print.xtable(xtable(x))
```
答案 0 :(得分:0)
这是一个乳胶问题(用keep_tex: true
检查输出:乳胶文档中的表格顺序正确)。默认情况下,print.xtable()
输出浮动表。它们不是准确定位在代码所在的位置,而是位于附近的某个位置。您可以使用表格定位来纠正此问题。例如(只是MWE中的相关位):
---
header-includes:
- \usepackage{float}
---
```{r}
options(xtable.comment = FALSE,
xtable.table.placement="H")
```