R语言 高分子聚合物胶乳

68bkxrlz  于 2022-12-06  发布在  其他
关注(0)|答案(1)|浏览(108)

我一直在遵循如何在KableExtra R markdown中的单元格中包含数学的示例,也许我做了一些非常愚蠢的事情,但我似乎不能让数学符号工作
以下示例如下:Latex Formulas or symbols in table cells using knitr and kableExtra in R-Markdown,但我似乎没有得到我的例子正确,因为它仍然给我在表结束时丢失的$错误。

output file: test.knit.md

! Missing $ inserted.
<inserted text> 
                $
l.125 \end{tabular}}

我正在尝试创建PDF文档

---
title: "Untitled"
author: "Willem"
date: "13 March 2019"
output: pdf_document
---

```{r packages, echo=F, warnings=F, message=F, eval=T}
require(knitr)
require(kableExtra)

Try out the table


table <- as.data.frame(matrix(c("LC variable","Small area of significant pixels in the centre","Large area possibly aligning with bushfire affected area.",
"t-test regression model residuals","Slightly lower mean residual ($p\\\\<0.05$) after change (0.5 mm per month)","Lower mean residual ($p\\\\<0.05$) after change (1.5 mm per month)",
"Positive score","0.2\\% of pixels at $p\\\\<0.1$","3.7\\% of pixel at $p\\\\<0.1$",
"Field significance of scores", "Both positive and negative within random distribution", "Positive outside random distribution."
),nrow=4,ncol=3, byrow=T))
kable(table,caption="Summary table of all tests on the two regions ", 'latex',
      booktabs =TRUE, escape=F,col.names = c("Test","Qld" ,"NSW VIC")) %>%
column_spec(2:3, width = "7cm") %>%
  kable_styling(latex_options = "scale_down")#%>%
  #kableExtra::landscape()

有人能看出我的错误吗?
nfeuvbwi

nfeuvbwi1#

---
title: "Untitled"
author: "Willem"
date: "13 March 2019"
output: pdf_document
---

```{r packages, echo=F, warnings=F, message=F, eval=T}
require(knitr)
require(kableExtra)

Try out the table


table <- as.data.frame(matrix(c("LC variable","Small area of significant pixels in the centre","Large area possibly aligning with bushfire affected area.",
"t-test regression model residuals","Slightly lower mean residual ($p<0.05$) after change (0.5 mm per month)","Lower mean residual ($p<0.05$) after change (1.5 mm per month)",
"Positive score","0.2\\% of pixels at $p<0.1$","3.7\\% of pixel at $p<0.1$",
"Field significance \\% of scores", "Both positive and negative \\% within random distribution", "Positive \\% outside random distribution."
),nrow=4,ncol=3, byrow=T))
kable(table,caption="Summary table of all tests on the two regions ", 'latex',
      booktabs =TRUE, escape=F,col.names = c("Test","Qld" ,"NSW VIC")) %>%
column_spec(2:3, width = "7cm") %>%
  kable_styling(latex_options = "scale_down")#%>%
  #kableExtra::landscape()

相关问题