tidymodels / broom

Convert statistical analysis objects from R into tidy format
https://broom.tidymodels.org
Other
1.45k stars 302 forks source link

Different tidy output for an object of class summary.glht when the package jtools is loaded #1161

Closed awcm0n closed 1 year ago

awcm0n commented 1 year ago

An object of class summary.glht submitted to tidy() produces a tibble with different column names if the package jtools is loaded:

Without jtools:

> broom::tidy(o)
# A tibble: 4 × 6
  contrast      null.value estimate std.error statistic adj.p.value
  <chr>         <dbl>    <dbl>     <dbl>     <dbl>      <dbl>
1 mar_jun_2020      0  0.00496   0.00531     0.935 0.350     
2 jul_dec_2020      0 -0.0144    0.00315    -4.56  0.00000508
3 mar_junXnojob     0  0.0470    0.0405      1.16  0.246     
4 jul_decXnojob     0  0.0506    0.0226      2.24  0.0254  

With jtools:

> library(jtools)
> broom::tidy(o)
# A tibble: 4 × 6
  lhs             rhs estimate std.error statistic    p.value
  <chr>              <dbl>    <dbl>     <dbl>     <dbl>       <dbl>
1 mar_jun_2020           0  0.00496   0.00531     0.935  0.350     
2 jul_dec_2020           0 -0.0144    0.00315    -4.56   0.00000508
3 mar_junXnojob          0  0.0470    0.0405      1.16   0.246     
4 jul_decXnojob          0  0.0506    0.0226      2.24   0.0254    
> packageVersion("broom")
[1] ‘1.0.4’
> packageVersion("jtools")
[1] ‘2.2.1’

Issue also reported at jacob-long/jtools

simonpcouch commented 1 year ago

Thanks for the issue!

There's not much I can do here from broom's perspective—jtools re-exports our generic and defines a duplicated method, which will take precedence in dispatch. This commit message speaks to some of their logic; they write

broom's tidy() method does not provide confidence intervals for glht objects

which is no longer the case, via https://github.com/tidymodels/broom/issues/1103.

github-actions[bot] commented 1 year ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.