我想使用kable函数将摘要统计信息放入表中,但是我不能,因为它以数组形式出现。
```{r setup options, include = FALSE}
knitr::opts_chunk$set(fig.width = 8, fig.height = 5, echo = TRUE)
library(mosaic)
library(knitr)
```
```{r}
sum = summary(SwimRecords$time) # generic data set included with mosaic package
kable(sum) # I want this to be printed into a table
```
有什么建议吗?
答案 0 :(得分:2)
您可以使用broom
软件包轻松地做到这一点,该软件包用于“整理”这些与统计信息有关的对象:
#install.packages(broom)
broom::tidy(sum)