0
votes

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!

1
Welcome to stackoverflow! By following this guide how to ask you provide a solid basis for answering this question. In particular, it's mostly necessary to provide an verifiable example (a minimum, complete, and verifiable example). Check out this page for tips regarding R-specific MCVEs. Good look and thank you for contributing! - mischva11
@mischva11 Thank you for the reminder! Edited original post with minimal working example. Hope this is correct? Thanks! - gravityflyer
@gravityflyer While it's good that you've added code to your question, link to data is generally considered a poor way to share it. Please re-read the top answer in the last link in mischava11's comment. - Z.Lin

1 Answers

1
votes

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.