【发布时间】:2021-05-24 02:30:06
【问题描述】:
当我运行 Knit 编译 Pdf 或 Html 时,我的 Rmarkdown 无法识别 kable_styling 中的 _。
我已按照 Yuhui Tinytex Debbuging 的建议更新了软件包(包括 tinytex 和 pandoc),并尝试在不同的 R 版本(3.6.3 和 4.0.4 - 64 位)中编译。
另外,我尝试安装包 ghostcript,但没有找到与我的任何 R 版本匹配的版本。
这是来自错误的消息
I was unable to find any missing LaTeX packages from the error log projeto1v2.log.
! Missing $ inserted.
<inserted text>
$
l.227 kable_
styling(full_width = FALSE,latex_options = "hold_position", ro...
Try to find the following text in projeto1v2.Rmd:
kable_
You may need to add $ $ around a certain inline R expression ´r ´ in projeto1v2.Rmd (see the above
hint). See https://github.com/rstudio/rmarkdown/issues/385 for more info.
Erro: LaTeX failed to compile projeto1v2.tex. See https://yihui.org/tinytex/r/#debugging for
debugging tips. See projeto1v2.log for more info.
Além disso: Warning message:
In has_crop_tools() :
Tool(s) not installed or not in PATH: ghostcript
-> As a result, figure cropping will be disabled.
Execução interrompida
一个可重现的例子:
library(kableExtra)
winelist <- data.frame(dados[1:12])
sumario <- round(sapply(dados, summary),2)
sumario <- t(sumario)
tabela1 <- data.frame(histograma="", sumario)
tabela1 %>%
kable(booktabs = TRUE) %>%
kable_styling(full_width = FALSE,latex_options = "hold_position",
row_label_position='c',
position='center') %>%
kable_paper(full_width = FALSE) %>%
column_spec(4, image = spec_hist(winelist))
来自 Kaggle 的数据集:Red Wine Quality
有人知道如何纠正这个错误吗?
【问题讨论】:
-
请提供更多细节,欢迎提供最小可复制示例 (stackoverflow.com/questions/5963269/…)。
-
欢迎您,@Jaylhane Veloso Nunes!能否请您提供
kable表的代码? -
你好@bttomio,我不知道在这种情况下它是否有用,但我会将代码添加到问题中。 (PS:大块工作正常,问题是我给针织的时候)。
-
能否请您尝试消除开头的换行符(```{r tabeladados})?
-
你好@bttmio,很抱歉,这是代码块中的代码。
标签: r r-markdown knitr inline blogdown