我对编织者比较陌生。我正在尝试创建一个包含小表的文档。例如,考虑以下rmd文档:
---
title: "Kable Test"
author: "Dave"
date: "January 8, 2016"
output: html_document
---
This R Markdown document is for testing kable output when kable is given a data.frame with only one row.
```{r}
library(knitr)
df = data.frame(x=1,y=100,z=1000)
kable(df)
```
This text is after the table.
当我编织此文档时,文本“此文本在表格后面”。获取格式,就像在表中一样。
我发现如果在kable(df)和纯文本之间包含一个空块,则该纯文本格式正确。
```{r}
kable(df)
```
```{r}
```
Same table followed by an empty chunk.
在这种情况下,“相同表...”的格式正确。
我应该使用kable的参数来避免插入空块吗?
谢谢戴夫
在块的末尾和新段落之间添加一个额外的换行符(空行):
---
title: "Kable Test"
author: "Dave"
date: "January 8, 2016"
output: html_document
---
This R Markdown document is for testing kable output when kable is given a data.frame with only one row.
```{r}
library(knitr)
df = data.frame(x=1,y=100,z=1000)
kable(df)
```
This text is after the table.
或使用pander::pander
,它会自动(通过在表后始终添加额外的换行符以避免这种混淆)和其他一些糖来自动执行此操作:
---
title: "Kable Test"
author: "Dave"
date: "January 8, 2016"
output: html_document
---
This R Markdown document is for testing kable output when kable is given a data.frame with only one row.
```{r}
library(knitr)
df = data.frame(x=1,y=100,z=1000)
pander::pander(df)
```
This text is after the table.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句