Skip to content
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

Trial dyn [email protected]@main #1628

Closed
wants to merge 77 commits into from
Closed

Conversation

Melkiades
Copy link
Collaborator

What changes are proposed in this pull request?
Integrate table printouts within example sections by leveraging raw html and decoupled file writing and reading.

If there is an GitHub issue associated with this pull request, please provide link.


Reviewer Checklist (if item does not apply, mark is as complete)

  • Ensure all package dependencies are installed by running renv::install()
  • PR branch has pulled the most recent updates from master branch. Ensure the pull request branch and your local version match and both have the latest updates from the master branch.
  • If an update was made to tbl_summary(), was the same change implemented for tbl_svysummary()?
  • If a new function was added, function included in _pkgdown.yml
  • If a bug was fixed, a unit test was added for the bug check
  • Run pkgdown::build_site(). Check the R console for errors, and review the rendered website.
  • Code coverage is suitable for any new functions/features. Review coverage with withr::with_envvar(new = c("NOT_CRAN" = "true"), covr::report()). Begin in a fresh R session without any packages loaded.
  • R CMD Check runs without errors, warnings, and notes
  • usethis::use_spell_check() runs with no spelling errors in documentation

When the branch is ready to be merged into master:

  • Update NEWS.md with the changes from this pull request under the heading "# gtsummary (development version)". If there is an issue associated with the pull request, reference it in parentheses at the end update (see NEWS.md for examples).
  • Increment the version number using usethis::use_version(which = "dev")
  • Run codemetar::write_codemeta()
  • Run usethis::use_spell_check() again
  • Approve Pull Request
  • Merge the PR. Please use "Squash and merge".

Copy link
Collaborator Author

@Melkiades Melkiades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it should pass the tests but we have two remaining issues in the printout: 1. After the first html any markdown used is lost (like if you use a italic text it will not be italic but there will be _). 2. The background follows the colorscheme of rstudio. I honestly do not know how to solve these issues.

Screenshot 2024-05-17 175203

@ddsjoberg
Copy link
Owner

Regarding the color. Perhaps we can make it a part of our print method to make the background white?
https://gt.rstudio.com/reference/tab_style.html

The markdown bit is confusing. What if we added gt::fmt_markdown(everything()) to our print method? Does that solve it?

ddsjoberg added 10 commits May 17, 2024 16:03
* progress

* Update add_stat.md

* lil updates

* Update _pkgdown.yml
* progress

* progress

* doc updates
* progress

* progress
…)`, `modify_caption()` (#1676)

* progress

* progress

* Create test-modify_spanning_header.R
…_alignment()`, `modify_column_indent()` (#1678)

* in progress

* progress

* progress
* progress

* Update DESCRIPTION

* Update DESCRIPTION
* progress

* Update _pkgdown.yml
@Melkiades
Copy link
Collaborator Author

gt::fmt_markdown(everything())

I tried both. The second does make the text invisible while the first one got me here
Screenshot 2024-05-21 165901

The generating table is the following (with the enforced setting):

  trial |>
    select(age, grade, response, trt) |>
    tbl_summary(
      by = trt,
      label = list(age = "Patient Age"),
      statistic = list(all_continuous() ~ "{mean} ({sd})"),
      digits = list(age = c(0, 1))
    ) |>
    as_gt() |>
    gt::tab_options() |>
    gt::tab_style(
      style = list(
        gt::cell_fill(color = "white"),
        gt::cell_text(color = "black"),
        gt::cell_borders(color = "lightgrey", sides = c("top", "bottom"))
      ),
      locations = gt::cells_body()
    ) 

The lightgrey is not respected. See the following from viewer
Screenshot 2024-05-21 165945

I have the feeling that these two are bugs/unexpected behavior from roxygen2

@ddsjoberg
Copy link
Owner

Let's put this on hold until we're further along with the unit testing. this is a lovely to have, and the unit tests are a must-have

@ddsjoberg ddsjoberg changed the base branch from v2.0 to main June 29, 2024 15:38
@ddsjoberg
Copy link
Owner

Hey hey @Melkiades , Thanks for working on this! Since the pkgdown site can now print the gt tables in the examples section, I think we can keep our pkg a bit simpler by skipping this feature. Thanks for looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants