larmarange / broom.helpers

A set of functions to facilitate manipulation of tibbles produced by broom
https://larmarange.github.io/broom.helpers/
GNU General Public License v3.0
22 stars 7 forks source link

Missing label for nnet::multinom() categorical variables #50

Closed ddsjoberg closed 4 years ago

ddsjoberg commented 4 years ago

I noticed a labelling error in nnet::multinom(). The label column is missing the variable label for the stage variable in the example below.

library(gtsummary)
#> #BlackLivesMatter

nnet::multinom(grade ~ age + stage, data = trial, trace = FALSE) %>%
  broom.helpers::tidy_plus_plus(add_header_rows = TRUE) %>%
  dplyr::select(y.level, variable, term, var_label, label, estimate)
#> # A tibble: 12 x 6
#>    y.level variable term    var_label label estimate
#>    <chr>   <chr>    <chr>   <chr>     <chr>    <dbl>
#>  1 II      age      age     Age       Age    0.00813
#>  2 II      stage    <NA>    T Stage   <NA>  NA      
#>  3 II      stage    stageT1 T Stage   T1     0      
#>  4 II      stage    stageT2 T Stage   T2    -0.497  
#>  5 II      stage    stageT3 T Stage   T3    -1.04   
#>  6 II      stage    stageT4 T Stage   T4    -0.634  
#>  7 III     age      age     Age       Age    0.0110 
#>  8 III     stage    <NA>    T Stage   <NA>  NA      
#>  9 III     stage    stageT1 T Stage   T1     0      
#> 10 III     stage    stageT2 T Stage   T2     0.128  
#> 11 III     stage    stageT3 T Stage   T3    -0.214  
#> 12 III     stage    stageT4 T Stage   T4     0.291

Created on 2020-10-04 by the reprex package (v0.3.0)

larmarange commented 4 years ago

Thank you for the catch

Should have been fixed now