尝试使用 stargazer 包创建回归 table 时出现缺失值问题

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

我正在尝试使用 stargazer 包来提取回归 table 但我得到:

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

但我的数据框中没有缺失值。

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")

奇怪,可能是某些依赖关系被破坏了。尝试 texreg::htmlreg,效果很好。

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