Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Refactored the `merge_levels_transformator` to handle the predefined inputs to the transformator ([#25](https://github.com/phuse-org/uteals/pull/25)).
- Added new `watermark_decorator` ([#23](https://github.com/phuse-org/uteals/pull/23)).
- Changed the example to a working one in `create_rel_risk_transformator` ([#27](https://github.com/phuse-org/uteals/pull/27))
- Changed the example to a working one in `ggplot_decorator` ([#28](https://github.com/phuse-org/uteals/pull/28))

# Version 0.0.2

Expand Down
39 changes: 30 additions & 9 deletions R/ggplot_decorator.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,38 @@
#' @importFrom ggplot2 scale_y_discrete geom_text layer_scales
#'
#' @examples
#' app <- teal::init(
#' data = teal.data::teal_data(IRIS = iris, code = "IRIS <- iris"),
#' modules = teal::modules(
#' data <- teal.data::teal_data()
#' data <- within(data, {
#' require(nestcolor)
#' ADSL <- teal.data::rADSL
#' })
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' # teal.modules.general >= 0.6.0
#' app <- init(
#' data = data,
#' modules = modules(
#' teal.modules.general::tm_g_scatterplot(
#' label = "Scatterplot Choices",
#' x = teal.transform::data_extract_spec(
#' dataname = "IRIS",
#' select = teal.transform::select_spec(choices = teal.transform::variable_choices(iris))
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' label = "Select variable:",
#' choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1", "BMRKR2")),
#' selected = "AGE",
#' multiple = FALSE,
#' fixed = FALSE
#' )
#' ),
#' y = teal.transform::data_extract_spec(
#' dataname = "IRIS",
#' select = teal.transform::select_spec(choices = teal.transform::variable_choices(iris))
#' y = data_extract_spec(
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' label = "Select variable:",
#' choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "BMRKR1", "BMRKR2")),
#' selected = "BMRKR1",
#' multiple = FALSE,
#' fixed = FALSE
#' )
#' ),
#' decorators = list(
#' plot = ggplot_decorator(
Expand All @@ -57,6 +78,7 @@
#' )
#' )
#' )
#'
#' if (interactive()) {
#' shinyApp(app$ui, app$server)
#' }
Expand Down Expand Up @@ -129,7 +151,6 @@ ggplot_decorator <- function(output_name,
shiny::moduleServer(id, function(input, output, session) {
shiny::reactive({
shiny::req(data())

data1 <- data()

if ("title" %in% to_render) {
Expand Down
38 changes: 30 additions & 8 deletions man/ggplot_decorator.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.