diff --git a/R/module_coda.R b/R/module_coda.R index b443523..26731ad 100644 --- a/R/module_coda.R +++ b/R/module_coda.R @@ -10,49 +10,47 @@ coda_ui <- function(id) { # Create a namespace function using the provided id ns <- NS(id) - fluidRow( - column( - width = 4, - wellPanel( - selectizeInput( - inputId = ns("codes"), - label = bslib::tooltip( - span("Unique identifiers", icon("info-circle")), - "Define the unique identifier (eg. laboratory codes) of each observation." - ), - choices = NULL, - selected = NULL, - multiple = FALSE, - options = list(plugins = "clear_button") + sidebarLayout( + sidebarPanel( + selectizeInput( + inputId = ns("codes"), + label = bslib::tooltip( + span("Unique identifiers", icon("info-circle")), + "Define the unique identifier (eg. laboratory codes) of each observation." ), - selectizeInput( - inputId = ns("samples"), - label = bslib::tooltip( - span("Sample names", icon("info-circle")), - "Duplicated sample names will be interpreted as repeated measurements." - ), - choices = NULL, - selected = NULL, - multiple = FALSE, - options = list(plugins = "clear_button") + choices = NULL, + selected = NULL, + multiple = FALSE, + options = list(plugins = "clear_button") + ), + selectizeInput( + inputId = ns("samples"), + label = bslib::tooltip( + span("Sample names", icon("info-circle")), + "Duplicated sample names will be interpreted as repeated measurements." ), - selectizeInput( - inputId = ns("groups"), - label = bslib::tooltip( - span("Groups", icon("info-circle")), - "Empty strings will be interpreted as unassigned samples." - ), - choices = NULL, - selected = NULL, - multiple = FALSE, - options = list(plugins = "clear_button") - ) - ), # wellPanel + choices = NULL, + selected = NULL, + multiple = FALSE, + options = list(plugins = "clear_button") + ), + selectizeInput( + inputId = ns("groups"), + label = bslib::tooltip( + span("Groups", icon("info-circle")), + "Empty strings will be interpreted as unassigned samples." + ), + choices = NULL, + selected = NULL, + multiple = FALSE, + options = list(plugins = "clear_button") + ), + hr(), ## Output: display description + h5("Description"), uiOutput(outputId = ns("description")) - ), # column - column( - width = 8, + ), # sidebarPanel + mainPanel( tabsetPanel( tabPanel( title = "Detection limits", @@ -72,8 +70,8 @@ coda_ui <- function(id) { DT::dataTableOutput(outputId = ns("table")) ) ) - ) # column - ) # fluidRow + ) # mainPanel + ) # sidebarLayout } # Server ======================================================================= @@ -213,33 +211,8 @@ coda_server <- function(id, x) { output$description <- renderUI({ req(clean()) - assigned <- nexus::is_assigned(clean()) - n_col <- ncol(clean()) - n_obs <- nrow(clean()) - n_spl <- length(unique(nexus::get_samples(clean()))) - n_rep <- sum(nexus::is_replicated(clean())) - n_grp <- length(unique(nexus::get_groups(clean())[assigned])) - n_out <- sum(!assigned) - - msg_parts <- sprintf("%d parts: %s", n_col, paste0(colnames(clean()), collapse = ", ")) - msg_obs <- sprintf("%d %s:", n_obs, ngettext(n_obs, "observation", "observations")) - msg_spl <- sprintf("%d unique %s", n_spl, ngettext(n_spl, "sample", "samples")) - msg_rep <- sprintf("%d replicated %s", n_rep, ngettext(n_rep, "observation", "observations")) - msg_grp <- sprintf("%d %s", n_grp, ngettext(n_grp, "group", "groups")) - msg_out <- sprintf("%d unassigned %s", n_out, ngettext(n_out, "sample", "samples")) - - tags$ul( - class = "list-group list-group-flush", - tags$li(class="list-group-item", msg_parts), - tags$li(class="list-group-item", msg_spl), - tags$li(class="list-group-item", msg_rep), - tags$li( - class="list-group-item", - msg_grp, - tags$ul(class = "list-group list-group-flush", list_group()) - ), - tags$li(class="list-group-item", msg_out) - ) + descr <- capture.output(nexus::describe(clean())) + markdown(descr) }) ## Render tables ----- diff --git a/R/module_data.R b/R/module_data.R index 13683a8..40d9b68 100644 --- a/R/module_data.R +++ b/R/module_data.R @@ -386,7 +386,6 @@ prepare_server <- function(id, x) { x = data_clean(), val = input ) - print(each_var) keep <- Reduce(f = `&`, x = each_var) if (all(!keep)) return(data_clean()) data_clean()[keep, , drop = FALSE]