问题描述
使用kableExtra文档.在RMardown中,我正在运行:
Using the kableExtra documentation. inside RMardown I am running:
```{r}
library(knitr)
library(kableExtra)
dt <- mtcars[1:5, 1:6]
kable(dt, format = "rmarkdown")
```
这实际上输出了一个表,但我也在控制台中得到了以下内容:
this actually outputs a table but I also get the following in the console:
Error in kable_rmarkdown(x = c("Mazda RX4", "Mazda RX4 Wag", "Datsun 710", :
could not find function "kable_rmarkdown"
当我切换到:
```{r}
library(knitr)
library(kableExtra)
dt <- mtcars[1:5, 1:6]
kable(dt, format = "latex")
```
我没有错误,也没有表格.我需要安装乳胶才能使用此功能吗?
I get no error and no table. Do I need to install latex to use this functionality?
推荐答案
只需将注释放在一起即可提供完整的答案:以下引文来自 kableExtra小插图:
Just to put the comments together for providing a complete answer: The following quote is from the kableExtra vignette:
因此您可以在两个示例(markdown和LaTeX)中编写:
So you can write in both your examples (markdown and LaTeX):
library(knitr)
library(kableExtra)
dt <- mtcars[1:5, 1:6]
kable(dt)
根据您的输出格式,您将获得以HTML或LaTeX(PDF)呈现的表格.是的:对于PDF,您将需要安装LaTeX.如今,使用 Xihui Xie的TinyTeX 可以很容易地做到这一点.
Depending on your output format you will get the table rendered in HTML or LaTeX (PDF). And yes: For PDF you will need a LaTeX installation. But this is nowadays quite easy with TinyTeX by Yihui Xie.
这篇关于R-Markdown-kableExtra软件包-format ='latex'不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!