GithubHelp home page GithubHelp logo

Comments (7)

larmarange avatar larmarange commented on June 28, 2024

tested added and fixed

from broom.helpers.

ddsjoberg avatar ddsjoberg commented on June 28, 2024

Am I missing something? I think this issue remains? The "factor(response):marker" variable is still showing on two lines.

remotes::install_github("larmarange/broom.helpers")
#> Using github PAT from envvar GITHUB_PAT
#> Skipping install of 'broom.helpers' from a github remote, the SHA1 (013085ed) has not changed since last install.
#>   Use `force = TRUE` to force installation
library(broom.helpers)
library(gtsummary)

lm(age ~ factor(response) * marker, trial) %>%
  tidy_and_attach() %>%
  tidy_identify_variables() %>%
  tidy_add_reference_rows() %>%
  tidy_add_variable_labels() %>%
  tidy_add_header_rows(show_single_row = "factor(response):marker") %>%
  knitr::kable()
term variable var_label var_class var_type header_row contrasts reference_row label estimate std.error statistic p.value
(Intercept) NA (Intercept) NA intercept NA NA NA (Intercept) 43.985685 1.906507 23.071342 0.0000000
NA factor(response) factor(response) factor categorical TRUE contr.treatment NA factor(response) NA NA NA NA
factor(response)0 factor(response) factor(response) factor categorical FALSE contr.treatment TRUE 0 NA NA NA NA
factor(response)1 factor(response) factor(response) factor categorical FALSE contr.treatment FALSE 1 9.117623 3.536300 2.578294 0.0107814
marker marker Marker Level (ng/mL) numeric continuous NA NA NA Marker Level (ng/mL) 2.007188 1.609824 1.246836 0.2141828
NA factor(response):marker factor(response) * Marker Level (ng/mL) NA interaction TRUE NA NA factor(response) * Marker Level (ng/mL) NA NA NA NA
factor(response)1:marker factor(response):marker factor(response) * Marker Level (ng/mL) NA interaction FALSE NA NA 1 * Marker Level (ng/mL) -5.337195 2.647510 -2.015930 0.0453914

Created on 2020-09-03 by the reprex package (v0.3.0)

from broom.helpers.

larmarange avatar larmarange commented on June 28, 2024

Oupsssss

OK I added a tests without adding reference row but I forgot a test sith reference row (because this is two different cases)!!!

Should be fixed by 5ee5781

from broom.helpers.

ddsjoberg avatar ddsjoberg commented on June 28, 2024

Fantastic! (I see that I added bad code the with the check for bad_single_row check..sorry! 😭 )

For the interaction handling, I think the label column should be equal to the variable label instead of the previous label that includes reference to the variable level ("factor(response) * Marker Level (ng/mL)" instead of "1 * Marker Level (ng/mL)").

library(broom.helpers)

lm(age ~ trt + factor(response) * marker, gtsummary::trial) %>%
  tidy_and_attach() %>%
  tidy_remove_intercept() %>%
  tidy_identify_variables() %>%
  tidy_add_reference_rows() %>%
  tidy_add_variable_labels() %>%
  tidy_add_header_rows(show_single_row = c("factor(response):marker", "trt")) %>%
  dplyr::select(any_of(c("variable", "var_label", "var_type", "header_row", 
                         "reference_row", "label", "estimate"))) %>%
  knitr::kable()
variable var_label var_type header_row reference_row label estimate
trt Chemotherapy Treatment categorical NA FALSE Chemotherapy Treatment 0.5592142
factor(response) factor(response) categorical TRUE NA factor(response) NA
factor(response) factor(response) categorical FALSE TRUE 0 NA
factor(response) factor(response) categorical FALSE FALSE 1 9.1100225
marker Marker Level (ng/mL) continuous NA NA Marker Level (ng/mL) 2.0504401
factor(response):marker factor(response) * Marker Level (ng/mL) interaction NA NA 1 * Marker Level (ng/mL) -5.3656455

Created on 2020-09-03 by the reprex package (v0.3.0)

from broom.helpers.

larmarange avatar larmarange commented on June 28, 2024

OK code changed to also cover interaction terms

from broom.helpers.

larmarange avatar larmarange commented on June 28, 2024

Last question: do we need to flag those lines and to add a single_row column?
Or no need for that?

from broom.helpers.

ddsjoberg avatar ddsjoberg commented on June 28, 2024

I don't think there is a need for that...I can't see how it would be used....... 🤔

from broom.helpers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.