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

Adds decorate functionality to module output #1357

Merged
merged 198 commits into from
Nov 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
b74d1f6
WIP
dependabot-preview[bot] Sep 26, 2024
6835c18
init
dependabot-preview[bot] Sep 27, 2024
9fc5923
WIP
dependabot-preview[bot] Sep 27, 2024
9bc0405
Merge branch 'main' into 1187_decorate_output@main
dependabot-preview[bot] Sep 27, 2024
9f4e6dd
[skip style] [skip vbump] Restyle files
github-actions[bot] Sep 30, 2024
fa117d1
multiple outputs
dependabot-preview[bot] Sep 30, 2024
ed29e78
Merge remote-tracking branch 'origin/main' into 1187_decorate_output@…
dependabot-preview[bot] Oct 3, 2024
c214c25
reshuffle validation of teal_transform_module
dependabot-preview[bot] Oct 4, 2024
5f7ab79
don't display UI if not specified
dependabot-preview[bot] Oct 7, 2024
898015f
Dispatch in teal_transform_module constructor
dependabot-preview[bot] Oct 8, 2024
b5cb59f
- make_teal_transform_server to simplify teal_transform_module's serv…
dependabot-preview[bot] Oct 9, 2024
30bb248
move teal_transform_module to a new file instead of keeping with teal…
dependabot-preview[bot] Oct 9, 2024
dfce86b
Merge branch 'main' into 1187_decorate_output@main
gogonzo Oct 30, 2024
1c75925
post merge fixes
gogonzo Oct 30, 2024
a92ebc9
Merge branch 'main' into 1187_decorate_output@main
gogonzo Nov 6, 2024
5894970
Merge branch 'main' into 1187_decorate_output@main
gogonzo Nov 7, 2024
b1b85d4
Merge branch 'main' into 1187_decorate_output@main
m7pr Nov 11, 2024
d2626b1
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 11, 2024
3cd4761
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Nov 11, 2024
a0977eb
Update R/teal_transform_module.R
m7pr Nov 11, 2024
51e10cd
Update R/teal_transform_module.R
m7pr Nov 11, 2024
9dfce2d
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Nov 11, 2024
e46964e
redact decorate-modules-output vignette
m7pr Nov 11, 2024
b54fd6d
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 11, 2024
8f03d2e
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 11, 2024
c2e530d
small edits to the second vignette
m7pr Nov 11, 2024
4be8b97
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 11, 2024
02de519
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 11, 2024
b09ff42
add init part to examples of teal_transform_data so it's clear where …
m7pr Nov 11, 2024
ac475e8
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 11, 2024
106bf4c
decorator -> decorators
m7pr Nov 11, 2024
5206bfe
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 11, 2024
a1888c0
Update R/teal_transform_module.R
m7pr Nov 11, 2024
4cabc0c
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Nov 11, 2024
e5e2e58
teal.data::datanames to names
m7pr Nov 11, 2024
d9bc6e7
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 11, 2024
f33669d
woops
m7pr Nov 11, 2024
8182e6d
ugh
m7pr Nov 11, 2024
38335b7
bring back extract_transformers
m7pr Nov 11, 2024
cabf9f2
Revert "bring back extract_transformers"
m7pr Nov 11, 2024
350d990
unify naming convention transformers->transforms
m7pr Nov 11, 2024
c36ab66
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 11, 2024
6eccdb8
fix 3 tests
m7pr Nov 11, 2024
6843cc8
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 11, 2024
bf210b4
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 11, 2024
1004af4
fix 2 more tests
m7pr Nov 11, 2024
df0b16e
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 11, 2024
5b7e901
change names of ui/srv_transform_data in vignette
m7pr Nov 12, 2024
9d82fea
fix vignette code
m7pr Nov 12, 2024
9d4eeac
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 12, 2024
e132211
remove pipe operator from vignette
m7pr Nov 12, 2024
64fbbbd
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 12, 2024
c84cbb6
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 12, 2024
64e7f5d
remove pipes, simplify example in the vignette, add skeleton tests
m7pr Nov 12, 2024
97b55af
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 12, 2024
4117417
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 12, 2024
7f1375f
Merge branch 'main' into 1187_decorate_output@main
m7pr Nov 13, 2024
f6a4513
documentation enhancemenes
m7pr Nov 13, 2024
81e1277
decorator example with DT table
m7pr Nov 13, 2024
6729e4d
update names in vignette
m7pr Nov 13, 2024
ecbf96f
extend example_module so it handles decorations
m7pr Nov 13, 2024
99c7a7c
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 13, 2024
e0bcb23
update NEWS
m7pr Nov 13, 2024
41fd9d7
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 13, 2024
cc1f7be
remove indent from format.teal_module
m7pr Nov 14, 2024
a1aaee2
fix Spell Check
m7pr Nov 14, 2024
fc596d4
missing chunk end typo
m7pr Nov 14, 2024
986a7c8
rename *_transofrm_data -> *_teal_transform_data
m7pr Nov 14, 2024
efdf8d2
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 14, 2024
e6c2ff0
fix pkgdown
m7pr Nov 14, 2024
f0e0605
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 14, 2024
875ccdb
update names in tests
m7pr Nov 14, 2024
56872ec
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Nov 14, 2024
e86e19f
Apply suggestions from code review
m7pr Nov 14, 2024
c2bc50d
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 14, 2024
e14f9b1
Update NEWS.md
m7pr Nov 14, 2024
f9bdb60
@gogonzo suggestions
m7pr Nov 14, 2024
f0b87f8
change transform to transformator
m7pr Nov 14, 2024
b54ebfc
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 14, 2024
a90544f
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Nov 14, 2024
d7f8366
update WORDLIST
m7pr Nov 14, 2024
d3c8830
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 14, 2024
0481d15
update docuemntaion
m7pr Nov 14, 2024
103ad27
change the object in example_module and document it
m7pr Nov 14, 2024
0e1d83f
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Nov 14, 2024
e91d198
update examples
m7pr Nov 14, 2024
7576e11
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Nov 14, 2024
8ced169
create two shinytest2 tests for decorators
m7pr Nov 14, 2024
9daa456
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 14, 2024
532fe73
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 14, 2024
40c73fd
combine decorator vignettes into one
m7pr Nov 14, 2024
a73dc58
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 14, 2024
80af8a2
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 14, 2024
5c839b5
lintr fixes
m7pr Nov 14, 2024
8bc8c10
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 14, 2024
3d5bc4e
rebuild docs
m7pr Nov 14, 2024
87acaec
fix one more test
m7pr Nov 14, 2024
2d7089c
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 14, 2024
28f17da
Update tests/testthat/test-shinytest2-decorators.R
m7pr Nov 14, 2024
8d3a465
Update R/modules.R
m7pr Nov 14, 2024
30002e1
bring back test for eventReactive value returned by teal_transform_mo…
m7pr Nov 14, 2024
0f6a2a8
merge
m7pr Nov 14, 2024
af099e8
prefix in vignette
m7pr Nov 14, 2024
37dc226
rerun docs
m7pr Nov 14, 2024
5663ca2
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Nov 14, 2024
717603d
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 14, 2024
31aa2d2
cleanup tests - remove ggplot2 examples
m7pr Nov 14, 2024
ceb97ff
Update R/dummy_functions.R
m7pr Nov 14, 2024
9ceff8b
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 14, 2024
0860bdf
fix: test with datanames validation
averissimo Nov 15, 2024
a8f1166
Merge branch 'main' into 1187_decorate_output@main
averissimo Nov 15, 2024
1f97c13
Update vignettes/decorate-module-output.Rmd
m7pr Nov 18, 2024
2bb9291
Update vignettes/decorate-module-output.Rmd
m7pr Nov 18, 2024
17afb2b
Update vignettes/decorate-module-output.Rmd
m7pr Nov 18, 2024
72e33f4
remove DT from vignette/dependencies
m7pr Nov 18, 2024
7bf54e7
Merge branch 'main' into 1187_decorate_output@main
m7pr Nov 18, 2024
6e9ae0c
change expression to language - as that's how it is documented in the…
m7pr Nov 18, 2024
0f51ce5
wrapper -> convenience function
m7pr Nov 18, 2024
5d09fcf
adjust intro
m7pr Nov 18, 2024
afbe5be
shiny::testServer tests for srv_teal_transform
m7pr Nov 18, 2024
4ba6320
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 18, 2024
2dae2b6
add pkgdown links to 1st appearance of the function in the decorators…
m7pr Nov 18, 2024
e39a883
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 18, 2024
60eec6e
be direct about which modules we talk
m7pr Nov 18, 2024
5007a82
Update R/dummy_functions.R
m7pr Nov 18, 2024
d395ac6
Update R/dummy_functions.R
m7pr Nov 18, 2024
d7c1f7e
Update R/modules.R
m7pr Nov 18, 2024
29ea4f1
change order of setnences in transofrmator vignette
m7pr Nov 18, 2024
cdf8797
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 18, 2024
9de76b9
Update vignettes/decorate-module-output.Rmd
m7pr Nov 18, 2024
f90bb77
Update vignettes/decorate-module-output.Rmd
m7pr Nov 18, 2024
75b41b9
Update vignettes/decorate-module-output.Rmd
m7pr Nov 18, 2024
1bdd159
link to teal_transform_module in transform vignettes
m7pr Nov 18, 2024
7a4778a
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 18, 2024
fd78283
Update vignettes/data-transform-as-shiny-module.Rmd
m7pr Nov 18, 2024
9e00183
Update vignettes/data-transform-as-shiny-module.Rmd
m7pr Nov 18, 2024
f329c0e
write about what is a decorator in general
m7pr Nov 18, 2024
6140ff8
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
m7pr Nov 18, 2024
585a3ba
Update vignettes/decorate-module-output.Rmd
m7pr Nov 18, 2024
33b308f
fix: tests
averissimo Nov 18, 2024
44e4bc3
fix: long test name
averissimo Nov 18, 2024
134dcf4
fix: long test name
averissimo Nov 18, 2024
21d0e36
fix: namespace in tests
averissimo Nov 18, 2024
5e088eb
Merge branch 'main' into 1187_decorate_output@main
m7pr Nov 19, 2024
b91b8c0
Apply suggestions from code review
m7pr Nov 19, 2024
cbc401e
this req is not needed
m7pr Nov 19, 2024
8a34f0f
apply @pawelru feedback
m7pr Nov 19, 2024
2c0dbf0
fix: namespace change in server function applied to UI
averissimo Nov 19, 2024
ad54746
docs: test title
averissimo Nov 19, 2024
5b402e2
fix: reactivity issue
averissimo Nov 19, 2024
ffe1a19
docs: fix spelling
averissimo Nov 19, 2024
1ad0b84
Merge branch 'main' into 1187_decorate_output@main
averissimo Nov 20, 2024
f264ad1
Merge branch 'main' into 1187_decorate_output@main
m7pr Nov 20, 2024
20a3962
Update tests/testthat/test-teal_transform_module.R
m7pr Nov 20, 2024
0003fef
@averissimo suggestions on debounce removal
m7pr Nov 20, 2024
1b0d5fd
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 20, 2024
42035b7
Update decorators vignette for multiple decorators (#1418)
m7pr Nov 20, 2024
cc32fe0
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 20, 2024
e1e49da
fix superlintr
m7pr Nov 20, 2024
fbd34d8
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 20, 2024
113b0c7
feat: updates decorators argument on dummy
averissimo Nov 21, 2024
28c50a9
feat: add print statement to code
averissimo Nov 21, 2024
62913ae
fix: tests uses list of decorators
averissimo Nov 21, 2024
f493ee1
fix: corrects e2e tests and small fixes
averissimo Nov 21, 2024
fa298c8
docs: add decorators param
averissimo Nov 21, 2024
ed921de
chore: fix linter errors
averissimo Nov 21, 2024
26ceb2d
Update R/dummy_functions.R
averissimo Nov 21, 2024
452c9da
[skip style] [skip vbump] Restyle files
github-actions[bot] Nov 21, 2024
2078b1f
docs: fixes params documentation
averissimo Nov 21, 2024
4340c2b
chore: adds ggplot2 to suggests
averissimo Nov 21, 2024
8f42166
fix: update e2e test with newer examples code
averissimo Nov 21, 2024
ab8fe49
fix: examples
averissimo Nov 21, 2024
8cb4a52
fix: R CMD check note
averissimo Nov 21, 2024
e0b9e0e
fix: remove unnecessary div
averissimo Nov 22, 2024
a9a0b0e
chore: improve on error message
averissimo Nov 22, 2024
e7747c5
chore: improve on error message (missing on last commit)
averissimo Nov 22, 2024
a71e6d5
chore: use safer ids in transformators
averissimo Nov 22, 2024
be49c50
chore: minor rename of id
averissimo Nov 22, 2024
0f9565c
fix: show errors in transform even if there is no UI
averissimo Nov 22, 2024
f67584f
chore: rename ui/srv_teal_transform_data to ui/srv_transform_teal_data
averissimo Nov 22, 2024
6389232
fix: e2e test that had the old namespace
averissimo Nov 22, 2024
347b82a
fix: typo on documentation
averissimo Nov 22, 2024
0a15929
Fix examples on decorator vignette (#1423)
llrs-roche Nov 22, 2024
6c353fe
fix: reactivity on input
averissimo Nov 26, 2024
3a9c68f
example for multiple outputs
m7pr Nov 29, 2024
8992555
Update vignettes/decorate-module-output.Rmd
m7pr Nov 29, 2024
6cd9662
Update vignettes/decorate-module-output.Rmd
m7pr Nov 29, 2024
a91a1cf
Update vignettes/decorate-module-output.Rmd
m7pr Nov 29, 2024
2685527
Update vignettes/decorate-module-output.Rmd
m7pr Nov 29, 2024
e04a892
Update vignettes/decorate-module-output.Rmd
m7pr Nov 29, 2024
33749d8
Update vignettes/decorate-module-output.Rmd
m7pr Nov 29, 2024
be6fa32
Update vignettes/decorate-module-output.Rmd
averissimo Nov 29, 2024
51b0964
Update vignettes/decorate-module-output.Rmd
averissimo Nov 29, 2024
2fd5402
docs: vignette cleanup
averissimo Nov 29, 2024
93fe55c
Merge branch 'main' into 1187_decorate_output@main
averissimo Nov 29, 2024
e2f58e9
pr feedback: simplify
averissimo Nov 29, 2024
e5acbdc
chore: add formatters to lookup references
averissimo Nov 29, 2024
c36e7b9
chore: minor clean of vignette
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
66 changes: 34 additions & 32 deletions vignettes/decorate-module-output.Rmd
m7pr marked this conversation as resolved.
Show resolved Hide resolved
m7pr marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ We modify the title and x-axis label of plot:
```{r}
library(teal)
m7pr marked this conversation as resolved.
Show resolved Hide resolved
static_decorator <- teal_transform_module(
label = "Static decorator",
server = function(id, data) {
moduleServer(id, function(input, output, session) {
reactive({
Expand All @@ -82,6 +83,7 @@ you can use the [`make_teal_transform_server()`](https://insightsengineering.git

```{r}
static_decorator_lang <- teal_transform_module(
m7pr marked this conversation as resolved.
Show resolved Hide resolved
label = "Static decorator (language)",
server = make_teal_transform_server(
expression(
plot <- plot +
Expand All @@ -100,6 +102,7 @@ Note how the input parameters are passed to the [`within`](https://insightsengin

```{r}
interactive_decorator <- teal_transform_module(
label = "Interactive decorator",
ui = function(id) {
ns <- NS(id)
div(
Expand Down Expand Up @@ -129,6 +132,7 @@ This wrapper requires you to use `input` object names directly in the expression

```{r}
interactive_decorator_lang <- teal_transform_module(
label = "Interactive decorator (language)",
ui = function(id) {
ns <- NS(id)
div(
Expand All @@ -155,6 +159,7 @@ In the following example, focus on the `output_name` parameter to see how decora
```{r}
gg_xlab_decorator <- function(output_name) {
teal_transform_module(
label = "X-axis decorator",
ui = function(id) {
ns <- NS(id)
div(
Expand Down Expand Up @@ -186,6 +191,7 @@ If a decorator fails, the outputs will not be shown, and an appropriate error me

```{r}
failing_decorator <- teal_transform_module(
label = "Failing decorator",
ui = function(id) {
ns <- NS(id)
div(
Expand All @@ -194,7 +200,7 @@ failing_decorator <- teal_transform_module(
},
server = function(id, data) {
moduleServer(id, function(input, output, session) {
reactive(stop("This is error"))
reactive(stop("\nThis is an error produced by decorator\n"))
})
}
)
Expand Down Expand Up @@ -357,8 +363,9 @@ tm_decorated_plot <- function(label = "module", decorators = NULL) {
updateSelectInput(inputId = "dataname", choices = names(data()))
})

observeEvent(input$dataname, {
req(input$dataname)
dataname <- reactive(req(input$dataname))

observeEvent(dataname(), {
updateSelectInput(inputId = "x", choices = colnames(data()[[input$dataname]]))
updateSelectInput(inputId = "y", choices = colnames(data()[[input$dataname]]))
})
Expand All @@ -374,7 +381,6 @@ tm_decorated_plot <- function(label = "module", decorators = NULL) {
})
})

dataname <- reactive(req(input$dataname))
x <- reactive({
req(input$x, input$x %in% colnames(data()[[dataname()]]))
input$x
Expand Down Expand Up @@ -403,7 +409,7 @@ tm_decorated_plot <- function(label = "module", decorators = NULL) {
})

decorated_data_no_print <- srv_transform_teal_data(
paste0("decorate_", selected_decorator()),
sprintf("decorate_%s", selected_decorator()),
data = plot_data,
transformators = decorators[[selected_decorator()]]
)
Expand All @@ -430,6 +436,7 @@ By order of the decorator we will:

```{r}
interactive_decorator_1 <- teal_transform_module(
label = "Interactive decorator 1",
ui = function(id) {
ns <- NS(id)
div(
Expand All @@ -453,6 +460,7 @@ interactive_decorator_1 <- teal_transform_module(
)

interactive_decorator_2 <- teal_transform_module(
label = "Interactive decorator 2",
ui = function(id) {
ns <- NS(id)
div(
Expand All @@ -476,6 +484,7 @@ interactive_decorator_2 <- teal_transform_module(
)

interactive_decorator_3 <- teal_transform_module(
label = "Interactive decorator 3",
ui = function(id) {
ns <- NS(id)
div(
Expand Down Expand Up @@ -540,7 +549,7 @@ The following module generates both a scatter plot and a summary table. Each of
```{r}
tm_decorated_plot_table <- function(label = "module with two outputs", decorators = list()) {
checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE)

module(
label = label,
ui = function(id, decorators) {
Expand All @@ -562,13 +571,13 @@ tm_decorated_plot_table <- function(label = "module with two outputs", decorator
updateSelectInput(inputId = "dataname", choices = names(data()))
})

observeEvent(input$dataname, {
req(input$dataname)
dataname <- reactive(req(input$dataname))

observeEvent(dataname(), {
updateSelectInput(inputId = "x", choices = colnames(data()[[input$dataname]]))
updateSelectInput(inputId = "y", choices = colnames(data()[[input$dataname]]))
})

dataname <- reactive(req(input$dataname))
x <- reactive({
req(input$x, input$x %in% colnames(data()[[dataname()]]))
input$x
Expand Down Expand Up @@ -597,11 +606,11 @@ tm_decorated_plot_table <- function(label = "module with two outputs", decorator
table_data <- reactive({
req(dataname())
within(data(),
{
table_data <- dataname %>%
dplyr::summarise(dplyr::across(dplyr::everything(), mean, na.rm = TRUE))
},
dataname = as.name(dataname())
{
table_data <- dataname %>%
dplyr::summarise(dplyr::across(dplyr::everything(), mean, na.rm = TRUE))
},
dataname = as.name(dataname())
)
})

Expand All @@ -619,28 +628,21 @@ tm_decorated_plot_table <- function(label = "module with two outputs", decorator
transformators = decorators$table
)

output$plot <- renderPlot({
req(decorated_plot())
decorated_plot()[["plot"]]
})
output$plot <- renderPlot(decorated_plot()[["plot"]])

output$table <- renderTable({
req(decorated_table())
decorated_table()[["table_data"]]
})
output$table <- renderTable(decorated_table()[["table_data"]])

output$text <- renderText({
plot_code <- teal.code::get_code(req(decorated_plot()))
table_code <- teal.code::get_code(req(decorated_table()))
paste("Plot Code:", plot_code, "\nTable Code:", table_code)
paste("# Plot Code:", plot_code, "\n\n# Table Code:", table_code)
})
})
},
ui_args = list(decorators = decorators),
server_args = list(decorators = decorators)
)
}

```


Expand All @@ -659,11 +661,10 @@ plot_decorator <- teal_transform_module(
reactive({
req(data())
within(data(),
{
plot <- plot +
ggplot2::ggtitle(ptitle)
},
ptitle = input$plot_title
{
plot <- plot + ggplot2::ggtitle(ptitle)
},
ptitle = input$plot_title
)
})
})
Expand All @@ -676,13 +677,15 @@ plot_decorator <- teal_transform_module(

```{r}
table_decorator <- teal_transform_module(
label = "Decorate plot",
server = make_teal_transform_server(
expression({
rownames(table_data) <- paste0("Row ", seq_len(nrow(table_data)))
table_data$id <- paste0("Row ", seq_len(nrow(table_data)))
table_data <- table_data[, union("id", colnames(table_data))]
colnames(table_data)[1] <- "ID (decorated)"
averissimo marked this conversation as resolved.
Show resolved Hide resolved
})
)
)

```


Expand All @@ -705,5 +708,4 @@ app <- init(
if (interactive()) {
shinyApp(app$ui, app$server)
}

```