diff --git a/bs/R/DoseResponse.R b/bs/R/DoseResponse.R index 08c2c3c..55574b0 100644 --- a/bs/R/DoseResponse.R +++ b/bs/R/DoseResponse.R @@ -13,6 +13,13 @@ DoseResponseSidebarUI <- function(id) { ), uiOutput(NS(id,"open_formula_editor_corr")), br(), + div( + class = "boxed-output", + uiOutput(NS(id, "open_split_by_group")), + uiOutput(NS(id, "data_splitted")), + verbatimTextOutput(NS(id, "applied_filter")) + ), + br(), textInput(NS(id, "substanceNames"), "Names column of dependent Variable", value = "names"), textInput(NS(id, "negIdentifier"), "Identifier for the negative control", value = "neg"), textInput(NS(id, "posIdentifier"), "Identifier for the positive control", value = "pos"), @@ -42,6 +49,55 @@ DoseResponseUI <- function(id) { DoseResponseServer <- function(id, data, listResults) { moduleServer(id, function(input, output, session) { + # Render split by group + output$open_split_by_group <- renderUI({ + actionButton(NS(id, "open_split_by_group"), + "Open the split by group functionality", + title = "Open the split by group helper window", + disabled = is.null(data$df) || !is.data.frame(data$df) + ) + }) + + observeEvent(input[["open_split_by_group"]], { + showModal(modalDialog( + title = "SplitByGroup", + SplitByGroupUI("SG"), + easyClose = TRUE, + size = "l", + footer = NULL + )) + }) + + # check if data is splitted + output$data_splitted <- renderUI({ + actionButton(NS(id, "remove_filter"), + "Remove the filter from the dataset", + title = "remove the filter of the dataset", + disabled = is.null(data$backup_df) || !is.data.frame(data$backup_df) + ) + }) + + observe({ + output$applied_filter <- renderText(NULL) + req(!is.null(data$filter_col)) + req(!is.null(data$filter_group)) + output$applied_filter <- renderText({ + paste0( + "The dataset is splitted by the variable ", + data$filter_col, + " and the group is ", + data$filter_group) + }) + }) + + # Remove filter + observeEvent(input[["remove_filter"]], { + data$df <- data$backup_df + data$backup_df <- NULL + data$filter_col <- NULL + data$filter_group <- NULL + }) + observeEvent(input[["df_help_icon"]], { showModal(modalDialog( title = "Example Dataframe", diff --git a/bs/R/assumption.R b/bs/R/assumption.R index a2e3327..cff9a77 100644 --- a/bs/R/assumption.R +++ b/bs/R/assumption.R @@ -3,6 +3,12 @@ assSidebarUI <- function(id) { "Assumption", tags$hr(), uiOutput(NS(id, "open_formula_editor_corr")), + div( + class = "boxed-output", + uiOutput(NS(id, "open_split_by_group")), + uiOutput(NS(id, "data_splitted")), + verbatimTextOutput(NS(id, "applied_filter")) + ), tags$hr(), tags$div( class = "header", checked = NA, @@ -59,6 +65,56 @@ assUI <- function(id) { assServer <- function(id, data, listResults) { moduleServer(id, function(input, output, session) { + # Render split by group + output$open_split_by_group <- renderUI({ + actionButton(NS(id, "open_split_by_group"), + "Open the split by group functionality", + title = "Open the split by group helper window", + disabled = is.null(data$df) || !is.data.frame(data$df) + ) + }) + + observeEvent(input[["open_split_by_group"]], { + showModal(modalDialog( + title = "SplitByGroup", + SplitByGroupUI("SG"), + easyClose = TRUE, + size = "l", + footer = NULL + )) + }) + + # check if data is splitted + output$data_splitted <- renderUI({ + actionButton(NS(id, "remove_filter"), + "Remove the filter from the dataset", + title = "remove the filter of the dataset", + disabled = is.null(data$backup_df) || !is.data.frame(data$backup_df) + ) + }) + + observe({ + output$applied_filter <- renderText(NULL) + req(!is.null(data$filter_col)) + req(!is.null(data$filter_group)) + output$applied_filter <- renderText({ + paste0( + "The dataset is splitted by the variable ", + data$filter_col, + " and the group is ", + data$filter_group + ) + }) + }) + + # Remove filter + observeEvent(input[["remove_filter"]], { + data$df <- data$backup_df + data$backup_df <- NULL + data$filter_col <- NULL + data$filter_group <- NULL + }) + output$open_formula_editor_corr <- renderUI({ actionButton(NS(id, "open_formula_editor"), diff --git a/bs/R/correlation.R b/bs/R/correlation.R index 259852f..906c37c 100644 --- a/bs/R/correlation.R +++ b/bs/R/correlation.R @@ -3,10 +3,12 @@ corrSidebarUI <- function(id) { "Correlation", uiOutput(NS(id, "open_formula_editor_corr")), br(), - uiOutput(NS(id, "open_split_by_group")), - br(), - uiOutput(NS(id, "data_splitted")), - verbatimTextOutput(NS(id, "applied_filter")), + div( + class = "boxed-output", + uiOutput(NS(id, "open_split_by_group")), + uiOutput(NS(id, "data_splitted")), + verbatimTextOutput(NS(id, "applied_filter")) + ), br(), actionButton(NS(id, "pear"), "Pearson correlation"), actionButton(NS(id, "spear"), "Spearman correlation"), @@ -44,7 +46,6 @@ corrUI <- function(id) { corrServer <- function(id, data, listResults) { moduleServer(id, function(input, output, session) { - # Render split by group output$open_split_by_group <- renderUI({ actionButton(NS(id, "open_split_by_group"), @@ -82,7 +83,8 @@ corrServer <- function(id, data, listResults) { "The dataset is splitted by the variable ", data$filter_col, " and the group is ", - data$filter_group) + data$filter_group + ) }) }) diff --git a/bs/R/statisticalTests.R b/bs/R/statisticalTests.R index 91755ea..a024c34 100644 --- a/bs/R/statisticalTests.R +++ b/bs/R/statisticalTests.R @@ -3,6 +3,12 @@ testsSidebarUI <- function(id) { "Tests", uiOutput(NS(id, "open_formula_editor_corr")), br(), + div( + class = "boxed-output", + uiOutput(NS(id, "open_split_by_group")), + uiOutput(NS(id, "data_splitted")), + verbatimTextOutput(NS(id, "applied_filter")) + ), conditionalPanel( condition = "input.TestsConditionedPanels == 'Two groups'", sliderInput(NS(id, "confLevel"), "Confidence level of the interval", @@ -111,6 +117,55 @@ testsUI <- function(id) { testsServer <- function(id, data, listResults) { moduleServer(id, function(input, output, session) { + # Render split by group + output$open_split_by_group <- renderUI({ + actionButton(NS(id, "open_split_by_group"), + "Open the split by group functionality", + title = "Open the split by group helper window", + disabled = is.null(data$df) || !is.data.frame(data$df) + ) + }) + + observeEvent(input[["open_split_by_group"]], { + showModal(modalDialog( + title = "SplitByGroup", + SplitByGroupUI("SG"), + easyClose = TRUE, + size = "l", + footer = NULL + )) + }) + + # check if data is splitted + output$data_splitted <- renderUI({ + actionButton(NS(id, "remove_filter"), + "Remove the filter from the dataset", + title = "remove the filter of the dataset", + disabled = is.null(data$backup_df) || !is.data.frame(data$backup_df) + ) + }) + + observe({ + output$applied_filter <- renderText(NULL) + req(!is.null(data$filter_col)) + req(!is.null(data$filter_group)) + output$applied_filter <- renderText({ + paste0( + "The dataset is splitted by the variable ", + data$filter_col, + " and the group is ", + data$filter_group) + }) + }) + + # Remove filter + observeEvent(input[["remove_filter"]], { + data$df <- data$backup_df + data$backup_df <- NULL + data$filter_col <- NULL + data$filter_group <- NULL + }) + output$open_formula_editor_corr <- renderUI({ actionButton(NS(id, "open_formula_editor"), "Open formula editor", diff --git a/bs/R/visualisation.R b/bs/R/visualisation.R index 148f08d..6de91e7 100644 --- a/bs/R/visualisation.R +++ b/bs/R/visualisation.R @@ -1,6 +1,12 @@ visSidebarUI <- function(id) { tabPanel( "Visualisation", + div( + class = "boxed-output", + uiOutput(NS(id, "open_split_by_group")), + uiOutput(NS(id, "data_splitted")), + verbatimTextOutput(NS(id, "applied_filter")) + ), textInput(NS(id, "yVar"), "Y variable", value = "y"), textInput(NS(id, "xVar"), "X variable", value = "x"), radioButtons(NS(id, "xType"), "Type of x", @@ -122,6 +128,56 @@ visUI <- function(id) { visServer <- function(id, data, listResults) { moduleServer(id, function(input, output, session) { + + # Render split by group + output$open_split_by_group <- renderUI({ + actionButton(NS(id, "open_split_by_group"), + "Open the split by group functionality", + title = "Open the split by group helper window", + disabled = is.null(data$df) || !is.data.frame(data$df) + ) + }) + + observeEvent(input[["open_split_by_group"]], { + showModal(modalDialog( + title = "SplitByGroup", + SplitByGroupUI("SG"), + easyClose = TRUE, + size = "l", + footer = NULL + )) + }) + + # check if data is splitted + output$data_splitted <- renderUI({ + actionButton(NS(id, "remove_filter"), + "Remove the filter from the dataset", + title = "remove the filter of the dataset", + disabled = is.null(data$backup_df) || !is.data.frame(data$backup_df) + ) + }) + + observe({ + output$applied_filter <- renderText(NULL) + req(!is.null(data$filter_col)) + req(!is.null(data$filter_group)) + output$applied_filter <- renderText({ + paste0( + "The dataset is splitted by the variable ", + data$filter_col, + " and the group is ", + data$filter_group) + }) + }) + + # Remove filter + observeEvent(input[["remove_filter"]], { + data$df <- data$backup_df + data$backup_df <- NULL + data$filter_col <- NULL + data$filter_group <- NULL + }) + plotFct <- function(method) { req(is.data.frame(data$df)) df <- data$df diff --git a/bs/R/www/styles.css b/bs/R/www/styles.css new file mode 100644 index 0000000..d20a78c --- /dev/null +++ b/bs/R/www/styles.css @@ -0,0 +1,39 @@ +.boxed-output { + border: 2px solid #900C3F; + padding: 10px; + border-radius: 5px; + margin-top: 10px; +} +.add-button { + position: relative; + padding-right: 20px; +} +.add-button::after { + content: '\\2295'; + position: absolute; + top: 1.1px; + right: 5px; + font-size: 16px; + font-weight: bold; + color: #900C3F; + background-color: white; + width: 15px; + height: 15px; + display: flex; + justify-content: center; + align-items: center; +} +.model { + background-color: #f8f9fa; + padding: 15px; + border: 2px solid #c8c8c8; + border-radius: 5px; + margin-top: 10px; +} +.title { + font-size: 14px; + font-weight: bold; + margin-bottom: 10px; + color: #333; +} +