Comments (3)
Should be noted, that then you specify manually a treatment contrast, R is not using anymore the level but the position of it. But it remains explicit and the label column is still correct.
library(broom.helpers)
library(gtsummary)
mod <- glm(age ~ grade, data = trial, family = gaussian, contrasts = list(grade = contr.treatment(3, base = 2)))
mod %>%
tidy_and_attach() %>%
tidy_identify_variables() %>%
tidy_add_variable_labels() %>%
tidy_add_reference_rows() %>%
tidy_add_header_rows() %>%
select(variable, term, reference_row, label, header_row)
#> # A tibble: 5 x 5
#> variable term reference_row label header_row
#> <chr> <chr> <lgl> <chr> <lgl>
#> 1 <NA> (Intercept) NA (Intercept) NA
#> 2 grade <NA> NA Grade TRUE
#> 3 grade grade1 FALSE I FALSE
#> 4 grade gradeII TRUE II FALSE
#> 5 grade grade3 FALSE III FALSE
from broom.helpers.
The issue with "gradeI"
is that naming convention is valid only for contr.treatment
, while contr.sum
and contr.SAS
adopt another approach (with the number instead of the level instead of its value).
However, should be possible to do something. I just need to reread properly the code
from broom.helpers.
OK it has been fixed:
library(broom.helpers)
library(gtsummary)
mod <- glm(age ~ grade, data = trial, family = gaussian)
mod %>%
tidy_and_attach() %>%
tidy_identify_variables() %>%
tidy_add_variable_labels() %>%
tidy_add_reference_rows() %>%
tidy_add_header_rows() %>%
select(variable, term, reference_row, label, header_row)
#> # A tibble: 5 x 5
#> variable term reference_row label header_row
#> <chr> <chr> <lgl> <chr> <lgl>
#> 1 <NA> (Intercept) NA (Intercept) NA
#> 2 grade <NA> NA Grade TRUE
#> 3 grade gradeI TRUE I FALSE
#> 4 grade gradeII FALSE II FALSE
#> 5 grade gradeIII FALSE III FALSE
from broom.helpers.
Related Issues (20)
- Support for mmrm models HOT 8
- Support for MASS::contr.sdif() contrasts
- Support for zero-inflated models
- beta regression is not supported yet HOT 2
- Considering a `tidy_post_fun` argument to `tidy_plus_plus()` HOT 2
- Support with coxphf model HOT 9
- Bug fixes and improvements for mixed models HOT 1
- tbl_regression (package gtsummary) and ggcoef_model (package ggstats) not working on the output of a replicate svyglm model HOT 2
- fantastic support of multivariate quantile regression for any quantile HOT 1
- Support for survival::cch model? HOT 5
- Avg_comparisons and nlme::lme() models HOT 1
- order of variable levels with marginal tidiers HOT 8
- Release broom.helpers 1.15.0
- Take into account (id) when computing model_get_n() for coxph models
- `marginaleffects::datagridcf()` is deprecated
- Do you know the status of the {margins} pkg? HOT 3
- Explore better support of VGAM::vglm() models HOT 1
- Execution time HOT 4
- marginaleffects::datagridcf() is deprecated
- pkgdown site has no search facility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from broom.helpers.