kable_input 使用 knitr 和 knitExtra 编织时未找到
kable_input not found when knitting using knitr and knitExtra
我是 R 的新手,我想使用 Rmarkdown 中的包 kable 和 knitExtra 来整理我的数据集 table。我将尝试通过我的代码来解释错误:
```{r, include=FALSE}
library(readxl); library(dplyr); library(kableExtra); library(knitr)
Froot <- read_excel("~/Documents/Project1/Fruit.xlsx")
knitr::kable(Froot[1:4])
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
在上面的代码中,当我尝试编织它时returns这个错误:
Quitting from lines 37-39 (Project1.Rmd)
Error in kable_styling(bootstrap_options = c("striped", "hover", "condensed")) :
argument "kable_input" is missing, with no default
Calls: ... withCallingHandlers -> withVisible -> eval -> eval -> kable_styling
Execution halted
我注意到错误在函数 "kable_styling" 中,因此我试图通过添加 "kable_input" 来解决问题,这将代码变成了这样:
```{r, include=FALSE}
library(readxl); library(dplyr); library(kableExtra); library(knitr)
Froot <- read_excel("~/Documents/Project1/Fruit.xlsx")
knitr::kable(Froot[1:4])
kable_styling(kable_input, bootstrap_options = c("striped", "hover", "condensed"))
但是我编织的时候提示找不到函数"kable_input"!!
Quitting from lines 37-39 (Project1.Rmd)
Error in kable_input() : could not find function "kable_input"
Calls: ... withCallingHandlers -> withVisible -> eval -> eval -> kable_styling
Execution halted
有任何修复吗?我试过用谷歌搜索,但我确实没有得到任何结果。
@stefan 是对的,您必须添加管道 %>% 并删除他在评论中所做的 kable_input 。此外,您可以从 chuck 中删除 include=FALSE(这会计算代码但不显示结果)。
```{r}
library(readxl)
library(dplyr)
library(kableExtra)
library(knitr)
Froot <- read_excel("~/Documents/Project1/Fruit.xlsx")
knitr::kable(Froot)%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
```
这个例子适用于我的情况:
knitr::kable(iris)%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
我是 R 的新手,我想使用 Rmarkdown 中的包 kable 和 knitExtra 来整理我的数据集 table。我将尝试通过我的代码来解释错误:
```{r, include=FALSE}
library(readxl); library(dplyr); library(kableExtra); library(knitr)
Froot <- read_excel("~/Documents/Project1/Fruit.xlsx")
knitr::kable(Froot[1:4])
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
在上面的代码中,当我尝试编织它时returns这个错误:
Quitting from lines 37-39 (Project1.Rmd)
Error in kable_styling(bootstrap_options = c("striped", "hover", "condensed")) : argument "kable_input" is missing, with no default
Calls: ... withCallingHandlers -> withVisible -> eval -> eval -> kable_styling
Execution halted
我注意到错误在函数 "kable_styling" 中,因此我试图通过添加 "kable_input" 来解决问题,这将代码变成了这样:
```{r, include=FALSE}
library(readxl); library(dplyr); library(kableExtra); library(knitr)
Froot <- read_excel("~/Documents/Project1/Fruit.xlsx")
knitr::kable(Froot[1:4])
kable_styling(kable_input, bootstrap_options = c("striped", "hover", "condensed"))
但是我编织的时候提示找不到函数"kable_input"!!
Quitting from lines 37-39 (Project1.Rmd)
Error in kable_input() : could not find function "kable_input"
Calls: ... withCallingHandlers -> withVisible -> eval -> eval -> kable_styling
Execution halted
有任何修复吗?我试过用谷歌搜索,但我确实没有得到任何结果。
@stefan 是对的,您必须添加管道 %>% 并删除他在评论中所做的 kable_input 。此外,您可以从 chuck 中删除 include=FALSE(这会计算代码但不显示结果)。
```{r}
library(readxl)
library(dplyr)
library(kableExtra)
library(knitr)
Froot <- read_excel("~/Documents/Project1/Fruit.xlsx")
knitr::kable(Froot)%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
```
这个例子适用于我的情况:
knitr::kable(iris)%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))