【发布时间】:2020-07-09 16:20:37
【问题描述】:
请参阅下面的 reprex1 和 reprex2。 lapply 运行但 sapply 有一个 " 添加到 .tex 文件的第 87 行的开头,打破了它。
想法?
---
title: "reprex"
output:
pdf_document:
latex_engine: xelatex
editor_options:
chunk_output_type: console
---
{r reprex1, echo=FALSE, warning=FALSE, message=FALSE, results='asis'}
library(tidyverse)
library(kableExtra)
species = c("Human", "Droid")
lapply(species, function(x){
starwars %>%
select(name, birth_year) %>%
kable() %>%
kable_styling(fixed_thead = TRUE, latex_options = c("striped", "scale_down"))%>%
row_spec(0, bold = TRUE)
})
{r reprex2, echo=FALSE, warning=FALSE, message=FALSE, results='asis'}
library(tidyverse)
library(kableExtra)
species = c("Human", "Droid")
sapply(species, function(x){
starwars %>%
select(name, birth_year) %>%
kable() %>%
kable_styling(fixed_thead = TRUE, latex_options = c("striped", "scale_down"))%>%
row_spec(0, bold = TRUE)
})
【问题讨论】:
标签: r r-markdown kable