-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should variable be populated for intercept terms? or stay NA as current? #66
Comments
I do not think it would be a problem to populate variable column with "(Intercept)". Let me check |
Dear @ddsjoberg , in fact it is already possible. Please note that your library(broom.helpers)
mod <- glm(response ~ age + grade, gtsummary::trial, family = binomial)
res <- mod %>% tidy_plus_plus(
intercept = T,
variable_labels = list("(Intercept)" = "custom")
)
res %>% dplyr::select(term, variable, var_label, label)
#> # A tibble: 5 x 4
#> term variable var_label label
#> <chr> <chr> <chr> <chr>
#> 1 (Intercept) <NA> custom custom
#> 2 age age Age Age
#> 3 gradeI grade Grade I
#> 4 gradeII grade Grade II
#> 5 gradeIII grade Grade III Created on 2020-10-21 by the reprex package (v0.3.0) |
However, it is TRUE that it is not clearly stated in the documentation. |
Now, I have also explored the possibility that, for intercepts, variable column will be populated with term content (i.e. for most models it will be "(Intercept"). Few adjustments are required (cf. https://github.com/larmarange/broom.helpers/pull/68/files ) So, it will be a minor break change, but it could be considered. |
tidy_plus_plus()
and tidy_identify_variables()
?
I like the idea of having the variable column populated. It'll make selecting that variable/term/intercept much easier to do by the name the users are seeing. My vote is to populate it! Also, I should note that since it's populated in gtsummary, if we choose not to populate, I'll populate it manually after running |
OK decided. PR merged. |
I started re-writing the broom.helpers section of
tbl_regression()
to usetidy_plus_plus()
instead of the individual functions. One of the reasons to use plus-plus over a series of othertidy_*()
functions, is that it will be easier for me to give users access to the other arguments intidy_plus_plus()
so they can change the resulting table if they like (e.g. adding the informative contrast labels @gorkang are working on).One sticking point is that I treat the intercept like a variable. For example, users can change the intercept label using
tbl_regression(label = list("(Intercept)" ~ "b0", age ~ "Patient Age"))
. Is there a way where the gtsummary API does not change, and I can usetidy_plus_plus()
?My first thought was to simply have an option in
tidy_identify_variables()
that populates the intercept variable column with the term name. But I am not sure if this will cause problems with other subsequent functions. What do you think?The text was updated successfully, but these errors were encountered: