Giter Club home page Giter Club logo

Comments (2)

larmarange avatar larmarange commented on June 9, 2024

If I may, some additional thoughts.

If the "theme env" is saved with the tbl object, you could consider two different options: set_gtsummary_theme() to change overall the theme elements for the future gtsummary objects that will be created, and a modify_gtsummary_theme() that could be applied on an existing table, e.g. tbl %>% modify_gtsummary_theme().

Another thought is the question of inheritance of theme elements. It exists in the code in many places, without being explicit. An example:

missing_text <- missing_text %||%
get_theme_element("tbl_svysummary-arg:missing_text") %||%
get_theme_element("tbl_summary-arg:missing_text",
default = translate_text("Unknown")
)

We could think about a better naming of the theme elements, showing the inheritance. An example:

  • pvalue_fun (overall default)
    • pvalue_fun.regression (value for tbl_regression())
    • pvalue_fun.summary (value for all summary functions)
      • pvalue_fun.summary.regular (value for tbl_summary() only)
      • pvalue_fun.summary.survey (value for tbl_svysummary() only)
      • pvalue_fun.summary.custom (value for tbl_custom_summary() only)

Then the code could be simplify in many places. We could simply call get_theme_element("pvalue_fun.summary.custom"). If this element is not defined (i.e. NULL) then get_theme_element() will look at "pvalue_fun.summary" and eventually at "pvalue_fun". With such naming (also used by ggplot2), inheritance will be explicit.

Another thought coming from ggplot::theme(): each theme element should be a named argument of set_gtsummary_theme() and modify_gtsummary_theme(). It would allow to use autocompletion to easily identify the name of a theme element, and improve the documentation of all of them.

from gtsummary.

larmarange avatar larmarange commented on June 9, 2024

Also, an internal function called when package is loaded to fix the default values at once would be relevant, to avoid indicating default values within each function.

from gtsummary.

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.