diff --git a/server.R b/server.R index bcbb75f76a521fd577d3a4f431c554d9cadc1049..596af5efaf42e108d20715f3e9e7591c309b6f2a 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") ) })