3

I try to make a table of summary statistics using R Markdown. Below is my code.

{r new, echo=TRUE, results='asis'}
ws <- t(as.matrix(summary(merged$WS)))
ows <- t(as.matrix(summary(merged$OWS)))

summary1 <- rbind(ws, ows)
rownames(summary1) <- c("Win Shares", "Offensive Win Shares") 

stargazer(summary1, title="A Few Summary Statistics on the Data")

When I compile, I get the following error:

! LaTeX Error: \caption outside float.

Error: LaTeX failed to compile stargazers_regressions.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See stargazers_regressions.log for more info. Execution halted

I have looked up caption outside float in regards to stargazer and haven't seen anything. I have updated all of my packages and even restarted R.

Edit:

Here's a very simple example that still fails:

x <- c(-4, -5)
y <- c(-8, -10)

table_1 <- rbind(x, y)

stargazer(table_1)

It seems that stargazer has an issue with negative numbers. When I changed x to c(4, 5), and y to c(8, 10), the program compiles fine.

Xito Parlo
  • 41
  • 2

0 Answers0