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

🗃️ decorators feature branch #795

Merged
merged 68 commits into from
Nov 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
661585d
WIP
gogonzo Oct 1, 2024
de6f56c
reorg regression for decoration
gogonzo Oct 1, 2024
f014f3e
feat: refactored outliers to allow for decorators (#788)
kpagacz Oct 4, 2024
6bb26f5
regression with validate
gogonzo Oct 4, 2024
d045e7b
elo
gogonzo Oct 4, 2024
95e0fbf
fixes
gogonzo Oct 4, 2024
bf87833
conditionalPanel for regression
gogonzo Oct 7, 2024
7c4996c
fix after teal
gogonzo Oct 9, 2024
8e8457d
fix error
gogonzo Oct 15, 2024
40f053a
Merge branch 'main' into 1187_decorate_output@main
gogonzo Nov 12, 2024
b6d9bff
update tm_a_regression and tm_outliers after changes in teal for the …
m7pr Nov 18, 2024
5196b7f
Update R/tm_outliers.R
m7pr Nov 18, 2024
f28d40d
unify decorators usage with outliers
m7pr Nov 18, 2024
bf0af48
Apply suggestions from code review
m7pr Nov 18, 2024
d52361b
add req statements to get_code
m7pr Nov 19, 2024
a3d3de8
remove examples and link to the vignette
m7pr Nov 19, 2024
7aed6cd
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 19, 2024
b26a29d
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 19, 2024
29eae48
Update R/tm_outliers.R
m7pr Nov 20, 2024
e598755
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 20, 2024
c491777
updates for req and documentation
m7pr Nov 20, 2024
09bb242
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 20, 2024
1c10233
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 20, 2024
97e60ef
move tm_outliers changes to different PR
m7pr Nov 20, 2024
3d48ec6
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 20, 2024
4c4d214
add req statement so that when srv_teal_transform_data returns NULL y…
m7pr Nov 21, 2024
ce1ba17
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 21, 2024
6dcb2ef
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 21, 2024
cf4371f
introduce decorators for `tm_g_bivariate` (#797)
m7pr Nov 21, 2024
612bb06
introduce decorators for `tm_g_response` (#802)
averissimo Nov 21, 2024
006b374
introduce decorators for `tm_g_distribution` (#801)
averissimo Nov 21, 2024
56be63f
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 21, 2024
7deda6d
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 21, 2024
824efcf
introduce decorators for `tm_t_crosstable` (#806)
m7pr Nov 22, 2024
0fcddf0
introduce decorators for `tm_a_pca` (#798)
m7pr Nov 22, 2024
f915e29
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 22, 2024
ba642f0
chore: rename ui/srv_teal_transform_data to ui/srv_transform_teal_data
averissimo Nov 22, 2024
11d9ea8
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 22, 2024
5f2d532
fix: move print statement after decoration
averissimo Nov 22, 2024
89f1d44
clean up print(plot) in `tm_g_distribution` module (#810)
m7pr Nov 22, 2024
9375353
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 22, 2024
09968a8
introduce decorators for `tm_g_scatterplotmatrix` (#808)
m7pr Nov 22, 2024
0870002
introduce decorators for `tm_g_scatterplot` (#807)
m7pr Nov 22, 2024
b6ca759
introduce decorators for `tm_g_association` (#800)
m7pr Nov 22, 2024
fb28571
introduce decorators for `tm_data_table` (#799)
m7pr Nov 22, 2024
9ef1032
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 22, 2024
9ae70c4
simplify usage for regression
m7pr Nov 25, 2024
18f1618
introduce decorators for `tm_missing_data` (#809)
m7pr Nov 26, 2024
817123a
introduce decorators for `tm_outliers` (#805)
m7pr Nov 26, 2024
9712e1c
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 26, 2024
8a96128
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 26, 2024
7e81203
revert: tm_missing_data qenv creation
averissimo Nov 26, 2024
4824e27
Updates "Decorators" to use name-based execution and new wrappers (#812)
averissimo Nov 28, 2024
6908d9c
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 28, 2024
39437e7
Update R/tm_g_distribution.R
averissimo Nov 28, 2024
2478c93
fix: linter error with long line
averissimo Nov 28, 2024
94cc740
docs: regenerate man pages
averissimo Nov 28, 2024
0357e15
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 28, 2024
0b2967e
fix: 3 out 4 e2e tests
averissimo Nov 28, 2024
040b311
fix: value was 2 not 1 in main
averissimo Nov 28, 2024
4e0d82e
docs: update missing @param
averissimo Nov 29, 2024
737fe42
docs: typo
averissimo Nov 29, 2024
f5a741a
fix: R CMD check errors and adds lifecycle to dependencies
averissimo Nov 29, 2024
db6793f
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 29, 2024
0048a41
fix: wrong function was being called
averissimo Nov 29, 2024
630ee6a
feat: build output objects separately
averissimo Nov 29, 2024
097326e
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Nov 29, 2024
1af3642
fix: minor bug
averissimo Nov 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove examples and link to the vignette
m7pr committed Nov 19, 2024
commit a3d3de80a153e46e7cc75b56c4fce4abfdcc7b48
42 changes: 5 additions & 37 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
@@ -42,50 +42,20 @@
#'
#' @inherit shared_params return
#'
#' @section Decorating Module Outputs:
#'
#' Decorating module outputs involves modifying the tables and plots generated by a module. This module provides the
#' ability to execute custom R code to adjust the visual or structural properties of objects displayed within the
#' application.
#'
#' The code specified in [`teal_transform_module`] is executed prior to rendering the outputs in the application. This
#' allows developers to modify attributes such as titles, labels, sizes, limits, and other features of rendered tables
#' and plots. However, decorators should be applied with careful consideration of the module's internal object names
#' to ensure compatibility.
#'
#' To customize an output, developers need to identify the name of the table or plot to be modified within the
#' `teal_transform_module`. This requires specifying a `server` function that modifies the targeted object in the
#' `data` object (of class `teal_data`). Since each module may use different internal object names or types for its
#' outputs, there is no universal code to achieve this. However, `teal` provides convenient wrappers to simplify the
#' process of decorating module outputs:
#' @section Decorating `tm_a_regression`:
#'
#' - **Decorator as a Language/Expression**: Specify a simple R expression to modify the object of interest.
#' For example,`plot <- plot + ggtitle("Custom Title")`. The expression must be valid and compatible with the module's
#' internal environment.
#' - **Decorator as a Function**: Provide a function that accepts the output object and modifies it as desired.
#' When using this approach, the function does not need to align with the module’s internal naming conventions for its
#' objects.
#' This module creates below objects that can be modified with decorators:
#' - `plot` (`ggplot2`)
#'
#' For additional details and examples of decorators, refer to the vignette
#' `vignette("decorate-modules-output", package = "teal")` or the [`teal_transform_module()`] documentation.
#'
#' @section Decorating `tm_a_regression`:
#'
#' This module creates below objects that can be modified with decorators:
#' - `plot` (`ggplot2`)#'
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#'
#' footnote_regression <- teal_transform_module(
#' server = make_teal_transform_server(expression(
#' plot <- plot + labs(caption = deparse(summary(fit)[[1]]))
#' ))
#' )
#'
#' # general data example
#' data <- teal_data()
#' data <- within(data, {
@@ -117,8 +87,7 @@
#' multiple = TRUE,
#' fixed = FALSE
#' )
#' ),
#' decorators = list(footnote_regression)
#' )
#' )
#' )
#' )
@@ -163,8 +132,7 @@
#' multiple = TRUE,
#' fixed = FALSE
#' )
#' ),
#' decorators = list(footnote_regression)
#' )
#' )
#' )
#' )
26 changes: 5 additions & 21 deletions R/tm_outliers.R
Original file line number Diff line number Diff line change
@@ -27,27 +27,21 @@
#'
#' @inherit shared_params return
#'
#' @inheritSection tm_a_regression Decorating Module Outputs
#' @section Decorating `tm_outliers`:
m7pr marked this conversation as resolved.
Show resolved Hide resolved
#'
#' This module creates below objects that can be modified with decorators:
m7pr marked this conversation as resolved.
Show resolved Hide resolved
#' - `table` (`data.frame`)
#' - `plot` (`ggplot2`)
#'
#' For additional details and examples of decorators, refer to the vignette
#' `vignette("decorate-modules-output", package = "teal")` or the [`teal_transform_module()`] documentation.
#'
#' @examplesShinylive
#' library(teal.modules.general)
#' interactive <- function() TRUE
#' {{ next_example }}
#' @examples
#'
#' module_decorator <- teal_transform_module(
#' server = make_teal_transform_server(
#' expression({
#' plot <- plot + ggplot2::ggtitle("A new title")
#' })
#' )
#' )
#'
#' # general data example
#' data <- teal_data()
#' data <- within(data, {
@@ -84,8 +78,7 @@
#' multiple = TRUE
#' )
#' )
#' ),
#' boxplot_decorator = module_decorator
#' )
#' )
#' )
#' )
@@ -99,14 +92,6 @@
#' {{ next_example }}
#' @examples
#'
#' module_decorator <- teal_transform_module(
#' server = make_teal_transform_server(
#' expression({
#' plot <- plot + ggplot2::ggtitle("A new title")
#' })
#' )
#' )
#'
#' # CDISC data example
#' data <- teal_data()
#' data <- within(data, {
@@ -145,8 +130,7 @@
#' multiple = TRUE
#' )
#' )
#' ),
#' boxplot_decorator = module_decorator
#' )
#' )
#' )
#' )
@@ -224,7 +208,7 @@
data_extract_list,
list(
plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args,
decorators = list(table = table_decorator, boxplot = boxplot_decorator, violin = violin_decorator, density = density_decorator, cum_dist = cum_dist_decorator)

Check warning on line 211 in R/tm_outliers.R

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_outliers.R,line=211,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 166 characters.
)
),
ui = ui_outliers,
@@ -998,10 +982,10 @@
)
})

decorated_boxplot_q <- srv_teal_transform_data("boxplot_decorator", data = boxplot_q, transformators = decorators$boxplot)

Check warning on line 985 in R/tm_outliers.R

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_outliers.R,line=985,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 126 characters.
decorated_violin_q <- srv_teal_transform_data("violin_decorator", data = boxplot_q, transformators = decorators$violin)

Check warning on line 986 in R/tm_outliers.R

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_outliers.R,line=986,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 123 characters.
decorated_density_plot_q <-srv_teal_transform_data("density_decorator", data = density_plot_q, transformators = decorators$density)

Check warning on line 987 in R/tm_outliers.R

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_outliers.R,line=987,col=30,[infix_spaces_linter] Put spaces around all infix operators.

Check warning on line 987 in R/tm_outliers.R

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_outliers.R,line=987,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 135 characters.
decorated_cumulative_plot_q <- srv_teal_transform_data("cum_dist_decorator", data = cumulative_plot_q, transformators = decorators$cum_dist)

Check warning on line 988 in R/tm_outliers.R

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_outliers.R,line=988,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 144 characters.

final_q <- reactive({
req(input$tabs)
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
#' with text placed before the output to put the output into context. For example a title.
#' @param post_output (`shiny.tag`) optional, text or UI element to be displayed after the module's output,
#' adding context or further instructions. Elements like `shiny::helpText()` are useful.
#' @param decorators (`list` of `teal_transform_module`) optional,
#' @param decorators `r lifecycle::badge("experimental")` (`list` of `teal_transform_module`) optional,
#' decorator for tables or plots included in the module.
#'
#' @param alpha (`integer(1)` or `integer(3)`) optional, specifies point opacity.