Code Monkey home page Code Monkey logo

Comments (3)

ddsjoberg avatar ddsjoberg commented on August 19, 2024

I love this. For now, these functions have only worked with tbl_summary(), and I have wanted to generalize them for tbl_regression(). We should implement something like this! Just need to decide on the best route!

The possible types would be continuous, categorical, dichotomous, interaction, and unknown (for when there is no model.frame() method)? We should probably implement selectors for all types (well, except known)?

  • all_continuous()
  • all_categorical(dichotomous = TRUE)
  • all_dichotomous()
  • all_interaction()

I can implement the same in gtsummary, but I am not sure I'll be able to merely reexport the broom.helper functions if I want them to work with all the gtsummary obejcts. For example, we also have a summary type called continuous2 that has it's own selector. There is likely a pretty straightforward way around the issue...just need to sit with it longer and think :)

from broom.helpers.

larmarange avatar larmarange commented on August 19, 2024

Sure, we should think properly how to implement it.

If I understood properly, your trick in broom::.tidy_tidyselect(), you recreate a tibble (df_empty) with the list of variables to be able to apply dplyr::select().

I guess you use something similar in gt_summary.

Maybe a possible trick could be to add a "var_type" attribute to each column of df_empty. Then, to create functions as is_continous(), is_categorical() who test the value of the attribute, and finaly to code all_categorical() as a where(is_categorical)?

Just brainstorming...

Just some clarifications: what is exactly the type continuous2?

Regards

from broom.helpers.

ddsjoberg avatar ddsjoberg commented on August 19, 2024

continuous2 variables are those that are summarized on 2 or more rows in tbl_summary() and tbl_svysummary().

trial %>%
  select(age, trt) %>%
  tbl_summary(
    by = trt,
    type = all_continuous() ~ "continuous2",
    statistic = all_continuous() ~ c("{N_nonmiss}",
                                     "{mean} ({sd})",
                                     "{median} ({p25}, {p75})"),
    missing = "no"
  )

image

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.