当我运行编织来编译kable_styling或Html时,我的Rmarkdown不能识别_。
我已经按照Yuhui的建议更新了包(包括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
有人知道怎么纠正这个错误吗?
发布于 2021-02-22 04:10:57
你的代码对我来说工作得很好。刚刚将column_spec更改为2:
---
title: "Wine"
output: pdf_document
---
```{r setup, include=FALSE}knitr::opts_chunk$set(echo =假,warning = FALSE,message =假)
```{r tabeladados}库(Readr)
存档<- read_csv(“winequality_red /winequality-red.csv”)
dados <- winequality_red
库(KableExtra)
酒商<- data.frame(dados1: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(2,图像=spec_hist(葡萄酒列表))
-output

https://stackoverflow.com/questions/66305686
复制相似问题