After I updated Rstudio some code that had previously worked fine now throws an error. I’ve confirmed that this isn’t due to the nature of my data by using mtcars for the same thing and getting the same error. I’ve tried updating the package, both from CRAN and GitHub, to no avail.
I’ve included a code example, and also attached a screenshot in case the issue is idiosyncratic to my machine. I’m running the latest versions of both R and Rstudio.
library(modelsummary)
library(kableExtra)
library(tidyverse)
# Create some example data and fit a model
data(mtcars)
model <- lm(mpg ~ cyl + hp, data = mtcars)
# Generate the model summary using kable as the output format
table_output <- modelsummary(model, output = "latex", stars = TRUE, title = "Model Summary")
# Style the table with kable_styling and add headers
#this is where I run into the problem
styled_table <- table_output %>%
add_header_above(c(" " = 1, "Model Results" = 2)) %>%
kable_styling(latex_options = "scale_down")