From eb23ee7ead6fe7af77fe3d2cd1658c070d804c60 Mon Sep 17 00:00:00 2001 From: Cedric Midoux <cedric.midoux@inra.fr> Date: Thu, 6 Sep 2018 10:14:50 +0200 Subject: [PATCH] collapsedBox --- server.R | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/server.R b/server.R index bcbb75f..596af5e 100644 --- a/server.R +++ b/server.R @@ -27,7 +27,7 @@ shinyServer options = list( dom = "lBtip", pageLength = 10, - lengthMenu = list(c(10, 25, 50, 100,-1), list('10', '25', '50', '100', 'All')), + lengthMenu = list(c(10, 25, 50, 100, -1), list('10', '25', '50', '100', 'All')), buttons = list( 'colvis', list( @@ -45,6 +45,17 @@ shinyServer ) } + collapsedBox <- function(data, title = title) { + box( + title = title, + width = NULL, + status = "primary", + collapsible = TRUE, + collapsed = TRUE, + data + ) + } + source({ "https://raw.githubusercontent.com/mahendra-mariadassou/phyloseq-extended/master/R/load-extra-functions.R" }) @@ -152,19 +163,10 @@ shinyServer output$sampledataTable <- renderUI({ validate(need(sample_data(data16S(), errorIfNULL = FALSE), "")) - box( - title = "Class of sample_data", - width = NULL, - status = "primary", - collapsible = TRUE, - collapsed = TRUE, - renderTable({ - (sapply(sample_data(data16S()), class)) - }, rownames = TRUE, colnames = FALSE) - ) - - #sapply(sample_data(data16S()), class) - #}, rownames = TRUE, colnames = FALSE, caption = "Class of sample_data", caption.placement = "top") + collapsedBox(renderTable({ + (sapply(sample_data(data16S()), class)) + }, rownames = TRUE, colnames = FALSE), + title = "Class of sample_data") }) output$summaryTable <- renderUI({ @@ -216,14 +218,7 @@ shinyServer label = "X : ", choices = c("..." = 0, sample_variables(data16S())) ), - box( - title = "RCode", - width = NULL, - status = "primary", - collapsible = TRUE, - collapsed = TRUE, - verbatimTextOutput("histScript") - ) + collapsedBox(verbatimTextOutput("histScript"), title = "RCode") ) }) -- GitLab