I recently updated my OS, packages, RStudio and R and I tried to run a .Rmd file that worked fine before all the updates. When I ran the .Rmd, I was getting the an error at the end (after it reachd 100%) when trying to render a PDF document (seen below). After breaking up and running my Rmarkdown file piece by piece, I discovered the problem was the scalebox =
argument I used to produce a table with texreg
. I'm glad I discovered the issue but I am curious why scalebox does not work in an Rmarkdown document anymore. Reprex below (if you remove scalebox = .75
, it will render just fine). Any thoughts?
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