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

Run as_gt() examples conditionally #338

Merged
merged 1 commit into from
Feb 15, 2024
Merged

Run as_gt() examples conditionally #338

merged 1 commit into from
Feb 15, 2024

Conversation

nanxstats
Copy link
Collaborator

Fixes #334

I used @examplesIf to only run the as_gt() examples when it is either in interactive mode OR not rendered by pkgdown.

#' @examplesIf interactive() && !identical(Sys.getenv("IN_PKGDOWN"), "true")

This will make the examples section in the pkgdown site not showing the 7,000 lines of raw HTML.


I did not choose to capture the tables as images and create an "example output" section to link them (what gtsummary does) because:

  • gt outputs is not the main theme of this package so it's less important to show what the output looks like.
  • Since we have 11 tables here, the saved PNG files will bloat up the bundled package size by at least 1 Mb.
  • One needs to regenerate the images using a script if the examples are updated. As people tend to forget about things outside of the standard workflow, it could become easily out of sync or a maintenance burden.

Copy link
Collaborator

@LittleBeannie LittleBeannie left a comment

Choose a reason for hiding this comment

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

Thanks, @nanxstats !

@LittleBeannie LittleBeannie merged commit 69ad566 into main Feb 15, 2024
8 checks passed
@LittleBeannie LittleBeannie deleted the as-gt-examples branch February 15, 2024 14:10
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.

Reasonable as_gt() code example output
2 participants