Kable 在 R 中强制我的表格高于我的文本,我该如何解决这个问题?

问题描述

我正在使用一些 Latex 处理以下代码(在 R 笔记本中制作可重现的报告文档,但由于某种原因,我的表格放在了我的文本和方程式上方。我该如何解决这个问题?enter image description here>

title: "Empirical Research in Finance"
subtitle: "**Hypothesis tests and simulation**" 
author: Faes E.
fontsize: 12pt
date: '*January 25,2021*'
output: 
    pdf_document: default
    html_document:
    df_print: paged
header-includes:
  - \usepackage{amsmath} \usepackage{color}
  - \usepackage{titling}
  - \pretitle{\begin{center}
    \includegraphics[width=4in,height=4in]{AMSLOGO.jpg}\LARGE\\}
  - \posttitle{\end{center}}
\thispagestyle{empty}
# copy the R logo to the current directory
file.copy(file.path(R.home("doc"),"html","AMSLOGO.jpg"),'.')
\newpage

\newpage

表 1 中对样本偏度的一阶和二阶矩进行了检查。可以看出,对于较大的样本,均值趋于零。对于方差,正在达到渐近方差。我们知道它应该呈现以下值(等式 2),因为我们知道偏度是渐近分布的,均值为 0,方差为 6/n(在这种情况下,n 是样本大小)。

\begin{equation} 
\tag{2} 
skewness \stackrel{a}{\sim}N(0,\dfrac{6}{n})
\end{equation}

```{r echo=FALSE}
kable(des(mom=S),digits= 3,caption = "Statistics for skewness") %>%
    kable_classic(full_width = F) %>%
     footnote(number = c("n is the sample size","std is the standard deviation"))
```

解决方法

就像 user2554330 回答正确并且对我有用:

您可以使用 kable(...,format = "latex",position = "h!") 给出一个非常强烈的建议,将其保留在原处。如果 LaTeX 认为这是一个坏主意,它仍然不会这样做。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...