-
-
Notifications
You must be signed in to change notification settings - Fork 2
Add transformators and decorators to modules
#338
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
Open
m7pr
wants to merge
9
commits into
main
Choose a base branch
from
decorators_transformators@main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5b4172f
transformators and decorators
m7pr 7e4a07c
[skip style] [skip vbump] Restyle files
github-actions[bot] 1021ec0
update documentation
m7pr 95b27c3
Merge branch 'decorators_transformators@main' of https://github.com/i…
m7pr 2d4779f
assert transformators
m7pr e991ea3
update documentation
m7pr d4b8f05
fix wordlist
m7pr 7c96ce6
fix r cmd check
m7pr 78d8873
reviewer;s comments
m7pr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| #' Decorating and transforming `teal.osprey` modules | ||
| #' | ||
| #' @description | ||
| #' Documentation for the `transformators` and `decorators` arguments accepted by all | ||
| #' `tm_g_*` modules in this package. | ||
| #' | ||
| #' @section Decorating Module: | ||
| #' | ||
| #' All `teal.osprey` plot modules expose a single decoratable output object named `plot`. | ||
| #' Decorators are passed as a named `list` of [`teal::teal_transform_module()`] objects; | ||
| #' the name of each list element must match the output object name (`"plot"`). | ||
| #' | ||
| #' ```r | ||
| #' tm_g_waterfall( | ||
| #' ..., | ||
| #' decorators = list( | ||
| #' plot = teal::teal_transform_module(...) # applied only to `plot` | ||
| #' ) | ||
| #' ) | ||
| #' ``` | ||
| #' | ||
| #' Decorator UI controls appear in the module **encoding** panel. Decorators run in the | ||
| #' module server after the plot is created and before it is rendered. | ||
| #' | ||
| #' **Important:** decorators must not change the class of `plot`. Use transformations | ||
| #' appropriate to the object type returned by the underlying [osprey] function. | ||
| #' | ||
| #' | Module | Output | Typical class of `plot` | | ||
| #' |--------|--------|-------------------------| | ||
| #' | `tm_g_spiderplot` | `plot` | `ggplot` | | ||
| #' | `tm_g_butterfly` | `plot` | `grob` / `gtable` | | ||
| #' | `tm_g_waterfall` | `plot` | `grob` / `gtable` | | ||
| #' | `tm_g_swimlane` | `plot` | `grob` / `gtable` | | ||
| #' | `tm_g_patient_profile` | `plot` | `grob` (`cowplot` layout) | | ||
| #' | `tm_g_ae_oview` | `plot` | `grob` | | ||
| #' | `tm_g_ae_sub` | `plot` | `grob` | | ||
| #' | `tm_g_events_term_id` | `plot` | `grob` | | ||
| #' | `tm_g_heat_bygrade` | `plot` | `grob` / `gtable` | | ||
| #' | ||
| #' - For **`ggplot`** outputs (`tm_g_spiderplot` only), use `ggplot2` modifiers | ||
| #' (for example via [`teal::make_teal_transform_server()`]). | ||
| #' - For **`grob`** outputs (all other modules), use [`tern::decorate_grob()`] or | ||
| #' other grid-compatible adjustments. Applying `ggplot2` layers to `plot` in | ||
| #' those modules will fail silently or break rendering. | ||
| #' | ||
| #' Four modules (`tm_g_ae_oview`, `tm_g_ae_sub`, `tm_g_events_term_id`, `tm_g_heat_bygrade`) | ||
| #' also provide built-in title and footnote controls via [`ui_g_decorate()`] and | ||
| #' [`srv_g_decorate()`]. User-defined decorators run **before** that built-in decoration step. | ||
| #' | ||
| #' @section Transforming input data: | ||
| #' | ||
| #' All `tm_g_*` modules also accept `transformators`, a named `list` of | ||
| #' [`teal::teal_transform_module()`] objects that modify module **input** data after | ||
| #' filtering. Their UI appears in the app filter sidebar under **Transform Data**. | ||
| #' | ||
| #' See `vignette("transform-input-data", package = "teal")` for transformators and | ||
| #' `vignette("transform-module-output", package = "teal")` for decorators. | ||
| #' | ||
| #' A demo app using every module with both mechanisms is in | ||
| #' `system.file("examples", "app_decorators_transformators.R", package = "teal.osprey")`. | ||
| #' | ||
| #' @name decorate_module_section | ||
| #' @keywords internal | ||
| NULL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.