hughjonesd / huxtable

An R package to create styled tables in multiple output formats, with a friendly, modern interface.
http://hughjonesd.github.io/huxtable
Other
322 stars 28 forks source link

error_pos = "same": significance stars after p-value in brackets #161

Closed ChrisWaloszek closed 4 years ago

ChrisWaloszek commented 4 years ago

When using error_pos = "same", the standard errors are displayed in the same cell as the estimates. However, the significance stars are located before the p-value in brackets, such that the estimates are not very nicely aligned:

  huxreg(lm1, lm3, error_pos = "same")
                  (1)                     (2)
  (Intercept)     981.607 (720.175)        6.269 *** (0.782)
  carat           4328.324 *** (136.755)   3.531 *** (0.149)
  depth           -27.785 * (11.656)       -0.019 (0.013)
  N               100                      100    
  R2              0.912                    0.854
  *** p < 0.001; ** p < 0.01; * p < 0.05.

To improve the alignment when using error_pos = "same", would it be possible to have the significance stars after the brackets? I.e. to have something more like the following:

   huxreg(lm1, lm3, error_pos = "same")
                  (1)                     (2)
  (Intercept)     981.607 (720.175)        6.269 (0.782) *** 
  carat           4328.324 (136.755) ***   3.531 (0.149) ***
  depth           -27.785 (11.656) *       -0.019 (0.013)
  N               100                      100    
  R2              0.912                    0.854
  *** p < 0.001; ** p < 0.01; * p < 0.05.
hughjonesd commented 4 years ago

Interesting. In general, putting stars after the estimate rather than the standard error seems to be the standard.

ChrisWaloszek commented 4 years ago

Truly the standard is different. When using error_pos = "same" the estimate, stars, and p-value appear very close to another which is nice. When using error_pos = "right" the p-value appears more to the right as all columns are spaced equally. Would it be an alternative solution to use error_pos = "same" but with all cell contents aligned to the decimal of the estimate (including also the statistics below)?

hughjonesd commented 4 years ago

There I think error_pos = "below" would do it. Or you could tweak column spacing with *_padding properties.

ChrisWaloszek commented 4 years ago

With the number of variables in the table, error_pos = "below" makes my tables very long and too long to display on a single page in landscape format. Thus, all in one row (estimate, stars, p-value), their alignment according to the decimal of the estimate and then sufficient padding between the columns would great improve readability.

hughjonesd commented 4 years ago

Sorry; I think this is just too much of a special case for huxreg() to deal with. I recommend using padding to get what you want.