Search code examples
rstargazer

stargazer rounding errors


The stargazer package is rounding my regression output. For example, stargazer takes my regression coefficient of -3.56588 and outputs -3.600. Following a comment posted here, I attempted to resolve using digits=NA, however, received the following error:

Error in paste(first.part, .format.decimal.character, decimal.part, sep = "") : object 'decimal.part' not found.

Minimal working example with an error message as follows:

library(stargazer)
data(mtcars)

mylogit <- glm(vs ~ cyl + disp + hp, data = mtcars, family = "binomial")
summary(mylogit)
stargazer(mylogit, digits=NA) 

mylogit2 <- glm(vs ~ disp + hp + qsec, data = mtcars, family = "binomial")
summary(mylogit2)
stargazer(mylogit2, digits=NA)  

Interestingly, the output works correctly for mylogit but not for mylogit2!

Any thoughts would be greatly appreciated!


Solution

  • Just in case anyone in the future encounters a similar problem, after much deliberation and frustration I decided to use the package texreg instead.

    texreg function

    Overall a very easy package to export Rstudio tables to LaTeX and, more importantly, does not cause any rounding issues.