已关注 this example ,这就是我所拥有的
# iris
This section is about the iris dataset
```{r, echo=FALSE, message=FALSE, warning=FALSE}
kable(head(iris[, 1:2]), format = "html") %>%
kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE, position = "float_right")
```
# mtcars
This section is about the mtcars dataset
```{r, echo=FALSE, message=FALSE, warning=FALSE}
kable(head(mtcars[, 1:2]), format = "html") %>%
kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE, position = "float_right")
```
但是输出看起来像这样:
如何使mtcars部分出现在iris部分下方?
最佳答案
我猜kableExtra
尚不提供此类功能。
但是,您可以解析为 html,并轻松执行以下操作:
---
title: "hi"
author: "me"
date: "March 23, 2018"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)
library(knitr)
library(kableExtra)
options(knitr.table.format = "html")
```
```{r}
kable(head(iris[, 1:2])) %>%
kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE, position = "float_right")
```
# iris
This section is about the iris dataset.
This could be a whole paragraph.
<p style="clear: both"></p>
```{r}
kable(head(mtcars[, 1:2])) %>%
kable_styling(bootstrap_options = c("striped", "hover"), full_width = FALSE, position = "float_right")
```
# mtcars
This section is about the mtcars dataset
相关位是<p style="clear: both"></p>
关于r - 将文字描述放在 kable 旁边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49457625/