Inconsistent renaming of statistic and estimate columns II
iagogv3 opened this issue · 4 comments
iagogv3 commented
Thanks too for adding this new feature. As #722 was closed, I open a new issue adapting the first example there.
When estimate"{estimate}"
for example (in order to include other things as estimate = "{estimate}{stars}"
) then estimate
column name is not modified.
Further, how to deal with "conf.int"
as 2 columns?
library(modelsummary)
mod <- lm(mpg ~ factor(cyl), mtcars)
modelsummary(
mod,
estimate = c("$\\hat{\\beta}$" = "{estimate}"),
statistic = c("Confidence Interval" = "conf.int"),
shape = term ~ model + statistic)
+ +--------------+---------+---------------------+--------+
| | (1) |
+--------------+---------+---------------------+--------+
| | Est. | Confidence Interval | Â |
+==============+=========+=====================+========+
| (Intercept) | 26.664 | 24.676 | 28.651 |
+--------------+---------+---------------------+--------+
| factor(cyl)6 | -6.921 | -10.108 | -3.734 |
+--------------+---------+---------------------+--------+
| factor(cyl)8 | -11.564 | -14.220 | -8.908 |
+--------------+---------+---------------------+--------+
| Num.Obs. | 32 | | |
+--------------+---------+---------------------+--------+
| R2 | 0.732 | | |
+--------------+---------+---------------------+--------+
| R2 Adj. | 0.714 | | |
+--------------+---------+---------------------+--------+
| AIC | 170.6 | | |
+--------------+---------+---------------------+--------+
| BIC | 176.4 | | |
+--------------+---------+---------------------+--------+
| Log.Lik. | -81.282 | | |
+--------------+---------+---------------------+--------+
| F | 39.698 | | |
+--------------+---------+---------------------+--------+
| RMSE | 3.07 | | |
+--------------+---------+---------------------+--------+
sessionInfo()
output
R version 4.3.3 (2024-02-29 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Spain.utf8 LC_CTYPE=Spanish_Spain.utf8 LC_MONETARY=Spanish_Spain.utf8
[4] LC_NUMERIC=C LC_TIME=Spanish_Spain.utf8
time zone: Europe/Madrid
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] modelsummary_2.0.0
loaded via a namespace (and not attached):
[1] sandwich_3.1-0 utf8_1.2.4 future_1.33.2 generics_0.1.3 tidyr_1.3.1 lattice_0.22-6
[7] listenv_0.9.1 effectsize_0.8.7 digest_0.6.35 magrittr_2.0.3 grid_4.3.3 estimability_1.5
[13] mvtnorm_1.2-4 fastmap_1.1.1 Matrix_1.6-5 backports_1.4.1 survival_3.5-8 multcomp_1.4-25
[19] purrr_1.0.2 fansi_1.0.6 TH.data_1.1-2 codetools_0.2-20 cli_3.6.2 rlang_1.1.3
[25] performance_0.11.0 parallelly_1.37.1 future.apply_1.11.2 splines_4.3.3 tinytable_0.2.1 tools_4.3.3
[31] datawizard_0.10.0 parallel_4.3.3 checkmate_2.3.1 coda_0.19-4.1 dplyr_1.1.4 bayestestR_0.13.2
[37] globals_0.16.3 vctrs_0.6.5 R6_2.5.1 zoo_1.8-12 lifecycle_1.0.4 emmeans_1.10.1
[43] MASS_7.3-60.0.1 insight_0.19.10 pkgconfig_2.0.3 pillar_1.9.0 data.table_1.15.4 glue_1.7.0
[49] lmtest_0.9-40 xfun_0.43 tibble_3.2.1 tidyselect_1.2.1 rstudioapi_0.16.0 parameters_0.21.6
[55] knitr_1.46 xtable_1.8-4 htmltools_0.5.8.1 tables_0.9.17 compiler_4.3.3
vincentarelbundock commented
You should use "conf.low"
and "conf.high"
instead.
iago-pssjd commented
You should use
"conf.low"
and"conf.high"
instead.
This answers my question on how to deal with "conf.int"
two columns, but does not solve the estimate
renaming issue
vincentarelbundock commented
Thanks for the report. Should be fixed now on github
iago-pssjd commented
Thanks!