firmo23
firmo23

Reputation: 8404

Issue with missing values when trying to create a regression table using stargazer package

Im trying to use stargazer package to extract a regression table but I get:

Error in if (nchar(text.matrix[r, c]) > max.length[real.c]) { : 
  missing value where TRUE/FALSE needed

but I do not have missing values in my dataframe.

EX<-structure(list(all_fear_fail = structure(c(31.2479995806889, 
                                               34.2465900565466, 34.2465900565466), label = "% fear of failure", format.stata = "%12.0g"), 
                   all_high_stat_entre = structure(c(72.8056631518627, 70.9662658311981, 
                                                     70.9662658311981), label = "% high status successful entrepreneurship", format.stata = "%12.0g"), 
                   patience = structure(c(-0.0529573631679846, -0.0529573631679846, 
                                          -0.201360121369362), label = "Patience as measured by the Global Preferences Survey", format.stata = "%9.0g"), 
                   risktaking = structure(c(-0.00846243005718053, -0.00846243005718053, 
                                            0.120764262974262), label = "Risk Taking as measured by the Global Preferences Survey", format.stata = "%9.0g")), row.names = c(NA, 
                                                                                                                                                                            -3L), class = c("tbl_df", "tbl", "data.frame"))

library(stargazer)
mlm1 <- lm(all_fear_fail ~  . , data =EX)
mlm2 <- lm(all_high_stat_entre ~  . , data = EX)

stargazer(mlm1,mlm2, type="html",
          dep.var.labels=c("all_fear_fail","all_high_stat_entre"),
 out="models.htm")

Upvotes: 0

Views: 243

Answers (1)

jay.sf
jay.sf

Reputation: 72828

Weird, probably some dependencies broken. Try texreg::htmlreg, works fine.

texreg::htmlreg(list(mlm1, mlm2), 
                custom.model.names=c("all_fear_fail", "all_high_stat_entre"),
                file="models.htm")

Upvotes: 1

Related Questions