我使用.html格式的RMarkdown生成数据和报告。我现在希望在.html文档中创建三个单独的表,但我不确定是否可以创建它们。我的data.frame
由呼叫日志,不同的位置和服务角色组成。还记录时间量(持续时间,以分钟为单位)。但是,我有很多工人的数据,所以希望按每个工人的ID进行分组。
我可以在Excel中创建一行三个(子集,不同的data.frames)吗?
我的data.set很敏感,所以这里有一个使用R的内置数据集和我的RMarkdown代码的例子。
---
title: <center> <h1>Call Centre Report</h1> </center>
output:
html_document
---
```{r echo=FALSE}
library("htmlTable")
htmlTable(subset(mtcars, gear=="4"),
header = paste(c("mpg", "cyl",
"disp", "hp", "drat",
"wt", "qsec", "vs", "am", "gear", "carb")))
```
```{r echo=FALSE}
library("htmlTable")
htmlTable(subset(iris, Species=="setosa"),
align="rrrr|r",
header = paste(c("Sepal Length", "Sepal Width",
"Petal Length", "Petal Width", "Species")))
```
```{r echo=FALSE}
library("htmlTable")
htmlTable(subset(chickwts, feed=="horsebean"),
align="r|r",
header = paste(c("Weight", "Feed")))
```
谢谢。
答案 0 :(得分:2)
您可以使用以下样式<div style="display:flex; justify-content: space-between;">
---
title: <center> <h1>Call Centre Report</h1> </center>
output:
html_document
---
<div style="display:flex; justify-content: space-between;">
```{r echo=FALSE}
library("htmlTable")
htmlTable(subset(mtcars, gear=="4"),
rnames = FALSE,
header = paste(c("mpg", "cyl",
"disp", "hp", "drat",
"wt", "qsec", "vs", "am", "gear", "carb")))
```
```{r echo=FALSE}
library("htmlTable")
htmlTable(subset(iris, Species=="setosa"),
align="rrrr|r",
rnames = FALSE,
header = paste(c("Sepal Length", "Sepal Width",
"Petal Length", "Petal Width", "Species")))
```
```{r echo=FALSE}
library("htmlTable")
htmlTable(subset(chickwts, feed=="horsebean"),
rnames = FALSE,
align="r|r",
header = paste(c("Weight", "Feed")))
```
</div>