我最近更新了我的操作系统、软件包、RStudio 和 R,并尝试运行一个在所有更新之前运行良好的 .Rmd 文件。当我运行 .Rmd 时,在尝试渲染 PDF 文档(见下文)时,最后(达到 100% 之后)出现错误。在逐个分解并运行我的 Rmarkdown 文件后,我发现问题出在scalebox =
我用来生成带有texreg
. 我很高兴我发现了这个问题,但我很好奇为什么 scalebox 不再在 Rmarkdown 文档中工作了。下面的 Reprex (如果你删除scalebox = .75
,它会渲染得很好)。有什么想法吗?
title: "Reprex"
author: "Author"
date: ""
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(texreg)
df <- data.frame(y = rnorm(100),
x = rnorm(100))
model <- lm(y ~ x, data = df)
```{r, results='asis'}
texreg(model,
scalebox = .75)
output file: Reprex.knit.md
! LaTeX Error: Can be used only in preamble.
Error: LaTeX failed to compile Reprex.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Reprex.log for more info.
Execution halted