From a4fc436c527dc31ec73a3cdd33c152ed03e59f2d Mon Sep 17 00:00:00 2001 From: kappelmann Date: Thu, 28 Nov 2019 17:35:07 +0100 Subject: [PATCH] Changed shiny app ui to have multiple tabs for power calculation, explanations, and references --- ui.R | 309 ++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 200 insertions(+), 109 deletions(-) diff --git a/ui.R b/ui.R index 4f0980f..03a7571 100644 --- a/ui.R +++ b/ui.R @@ -7,122 +7,213 @@ library("shiny") library("semantic.dashboard") -ui <- dashboardPage( + +# -----------------Sidebar-------------------------------- + +sidebar <- dashboardSidebar( + side = "left", + color = "blue", + size = "thin", + inverted = TRUE, - dashboardHeader( + sidebarMenu( + + menuItem("Power Calculation", tabName = "calculation", icon = icon("calculator")), + menuItem("Explanations", tabName = "explanation", icon = icon("th")), + menuItem("Reference", tabName = "reference", icon = icon("info circle")) + + ) +) + +# -----------------Body----------------------------------- + +body <- dashboardBody( + tabItems( + + # -----------------Power Calculation Tab---------------- + tabItem(tabName = "calculation", + + + fluidRow( + + + # ----------Power Analysis Output--------- + box( + title = "Power Analysis", + color = "blue", + + h1("Power Calculation"), + p("Below you can find results from power analysis for the", strong("nested-precision Randomised Controlled Trial (npRCT)"),". You can set parameters for power analysis in the box to the right. Results from power analysis will change accordingly below."), + box( + title = "Results", + color = "blue", + collapsible = FALSE, + + h3("Total Sample Size"), + textOutput("n_total"), + + h3("Point of Stratification"), + textOutput("n_strat"), + + h3("Saved Sample Size"), + textOutput("n_saved") + ) + ), + + + # ----------Set RCT Parameters------------ + box( + title = "Set Parameters", + color = "blue", + + + # ----------Traditional RCT Parameters------------ + h2("Traditional RCT"), + sliderInput("d1", + "Effect Size", + step = 0.01, + min = 0, + max = 1, + value = 0.5), + br(), + sliderInput("power1", + "Power", + step = 0.01, + min = 0.5, + max = 1, + value = 0.8), + br(), + sliderInput("sig.level1", + "Significance Level", + step = 0.001, + min = 0.001, + max = 0.1, + value = 0.05), + br(), + radioButtons("alternative1", + NULL, + c("Two Sided Test"= "two.sided", + "One Sided Test"= "greater"), + selected = "two.sided"), + + + # ----------Precision RCT Parameters------------ + h2("Precision RCT"), + sliderInput("d2", + "Effect Size", + step = 0.01, + min = 0, + max = 1, + value = 0.5), + br(), + sliderInput("power2", + "Power", + step = 0.01, + min = 0.5, + max = 1, + value = 0.8), + br(), + sliderInput("sig.level2", + "Significance Level", + step = 0.001, + min = 0.001, + max = 0.1, + value = 0.05), + br(), + radioButtons("alternative2", + NULL, + c("Two Sided Test"= "two.sided", + "One Sided Test"= "greater"), + selected = "two.sided") + + ) + + + + + ) + + + ), + + + # -----------------Explanation Tab---------------------- + tabItem(tabName = "explanation", + + + + fluidRow( + + + + # ----------Ethical Implications--------------- + box( + title = "Ethical Implications", + color = "blue", + + #h2("Ethical Implications"), + p("There are the following ethical implications.") + + + ), + + # ----------Negative Values------------------- + box( + title = "Negative Values", + color = "blue", + + #h2("Negative Values"), + p("Below you can find results from power analysis for the", strong("nested-precision Randomised Controlled Trial (npRCT)"),". You can set parameters for power analysis in the box to the right. Results from power analysis will change accordingly below.") + + ) + + ) + + ), + + + # -----------------Reference Tab---------------------- + tabItem(tabName = "reference", + + + + fluidRow( + + + + # ----------Reference box--------------------- + box( + title = "References", + color = "blue", + + #h2("Ethical Implications"), + p(strong("This is where the letter is published.")) + + + ) + + + ) + + ) + + ) +) + +# -----------------Defining UI---------------------------- + +ui <- dashboardPage( + dashboardHeader( + h1("nested-precision Randomised Controlled Trial (npRCT)", style = "color:black"), color = "blue", disable = FALSE ), - dashboardSidebar( - side = "left", - color = "blue", - size = "thin", - helpText("This is a help text."), - - - ), - - - # ----------------dashboardBody--------------------- - dashboardBody( - fluidRow( - - - - # ----------Power Analysis Output--------- - box( - title = "Power Analysis", - color = "blue", - - h1("npRCT"), - p("Below you can find results from power analysis for the", strong("nested-precision Randomised Controlled Trial (npRCT)"),". You can set parameters for power analysis in the box to the right. Results from power analysis will change accordingly below."), - box( - title = "Results", - color = "grey", - - h3("Total Sample Size"), - textOutput("n_total"), - - h3("Point of Stratification"), - textOutput("n_strat"), - - h3("Saved Sample Size"), - textOutput("n_saved") - ) - ), - - - # ----------Set RCT Parameters------------ - box( - title = "Set Parameters", - color = "blue", - - - # ----------Traditional RCT Parameters------------ - h2("Traditional RCT"), - sliderInput("d1", - "Effect Size", - step = 0.01, - min = 0, - max = 1, - value = 0.5), - br(), - sliderInput("power1", - "Power", - step = 0.01, - min = 0.5, - max = 1, - value = 0.8), - br(), - sliderInput("sig.level1", - "Significance Level", - step = 0.001, - min = 0.001, - max = 0.1, - value = 0.05), - br(), - radioButtons("alternative1", - NULL, - c("Two Sided Test"= "two.sided", - "One Sided Test"= "greater"), - selected = "two.sided"), - - - # ----------Precision RCT Parameters------------ - h2("Precision RCT"), - sliderInput("d2", - "Effect Size", - step = 0.01, - min = 0, - max = 1, - value = 0.5), - br(), - sliderInput("power2", - "Power", - step = 0.01, - min = 0.5, - max = 1, - value = 0.8), - br(), - sliderInput("sig.level2", - "Significance Level", - step = 0.001, - min = 0.001, - max = 0.1, - value = 0.05), - br(), - radioButtons("alternative2", - NULL, - c("Two Sided Test"= "two.sided", - "One Sided Test"= "greater"), - selected = "two.sided") - - ) - ) - ) + sidebar, + body ) +