diff options
author | Naeem Model <me@nmode.ca> | 2023-06-27 03:40:33 +0000 |
---|---|---|
committer | Naeem Model <me@nmode.ca> | 2023-06-27 03:40:33 +0000 |
commit | 18358add05e58e466ba7098f771e20d8d0599d0e (patch) | |
tree | 410fbf865ee68b1412dd7d773b4b7da3d45ed137 /R | |
parent | 6caff1be02042720e8f362573533914a975d4e1a (diff) |
Remove 'shinyBS' dependency
Diffstat (limited to 'R')
-rw-r--r-- | R/app.R | 2 | ||||
-rw-r--r-- | R/ui.R | 154 |
2 files changed, 80 insertions, 76 deletions
@@ -4,8 +4,6 @@ app <- function() { if (!requireNamespace("shiny", quietly=TRUE)) stop("The package 'shiny' must be installed to launch the Rnaught web application.") - if (!requireNamespace("shinyBS", quietly=TRUE)) - stop("The package 'shinyBS' must be installed to launch the Rnaught web application.") shiny::shinyApp(ui(), server) } @@ -1,7 +1,7 @@ ui <- function() { shiny::fluidPage( # Title. - shiny::titlePanel(shiny::HTML(paste0("Rnaught: an estimation suite for R", shiny::tags$sub("0")))), + shiny::titlePanel(shiny::HTML(paste0("Rnaught: An Estimation Suite for R", shiny::tags$sub("0")))), # Sidebar layout. shiny::sidebarLayout( @@ -10,19 +10,20 @@ ui <- function() { shiny::sidebarPanel(id="sidebar", # Data tab sidebar. shiny::conditionalPanel(condition="input.tabset == 'Data'", - shiny::h4("Enter data"), + shiny::h3("Enter data"), # Data input method selection. shiny::radioButtons(inputId="dataInputMethod", label="", choices=list("Manually"=1, "Upload a .csv file"=2, "Paste a .csv file"=3)), # Option 1: Manual entry. shiny::conditionalPanel(condition="input.dataInputMethod == '1'", shiny::textInput(inputId="dataName", label="Dataset name"), - shiny::span(shiny::textOutput(outputId="dataNameWarn"), style="color: red"), + shiny::span(shiny::textOutput(outputId="dataNameWarn"), style="color: red;"), shiny::fluidRow( - shiny::column(8, shiny::textInput(inputId="dataCounts", label=shiny::HTML(paste0("Case counts", shiny::tags$sup(id="dataCountsHelp", "[?]"))))), + shiny::column(8, shiny::textInput(inputId="dataCounts", label=shiny::HTML(paste0( + "Case counts", shiny::tags$sup("[?]", title="Enter as a comma-separated list of positive integers, with at least two entries. Ex: 1,1,2,3,5,8")))) + ), shiny::column(4, shiny::selectInput(inputId="dataUnits", label="Reporting frequency", choices=list("Daily", "Weekly"))) ), - shinyBS::bsTooltip(id="dataCountsHelp", "Enter as a comma-separated list of positive integers, with at least two entries. Ex: 1,1,2,3,5,8", placement="right", trigger="hover"), - shiny::span(shiny::textOutput(outputId="dataCountsWarn"), style="color: red") + shiny::span(shiny::textOutput(outputId="dataCountsWarn"), style="color: red;") ), # Option 2: Upload .csv file. shiny::conditionalPanel(condition="input.dataInputMethod == '2'", @@ -34,82 +35,87 @@ ui <- function() { ), # Warning text for .csv upload / paste. shiny::conditionalPanel(condition="['2', '3'].includes(input.dataInputMethod)", - shiny::span(shiny::textOutput(outputId="dataCSVWarn"), style="color: red"), + shiny::span(shiny::textOutput(outputId="dataCSVWarn"), style="color: red;"), ), # Button to add data. shiny::actionButton(inputId="addData", label="Add"), ), - # Estimators tab sidebar + # Estimators tab sidebar (collapsable entries). shiny::conditionalPanel(condition="input.tabset == 'Estimators'", - shiny::h4("Estimators"), - # Collapsible menu for estimation methods. - shinyBS::bsCollapse(id="estCollapse", - # WHITE & PANAGO (WP). - shinyBS::bsCollapsePanel(title="White & Panago (WP)", - "This is a description of the method.", - shiny::br(), shiny::br(), - shiny::radioButtons(inputId="serialWPKnown", label="Is the mean serial interval known?", inline=TRUE, choices=list("Yes"=1, "No"=2)), - # Known serial interval. - shiny::conditionalPanel(condition="input.serialWPKnown == '1'", - shiny::fluidRow( - shiny::column(8, shiny::textInput(inputId="serialWPInput", label="Mean Serial Interval")), - shiny::column(4, shiny::selectInput(inputId="serialWPUnits", label="Time units", choices=list("Days", "Weeks"))) - ), - shiny::span(shiny::textOutput(outputId="serialWPWarn"), style="color: red") - ), - # Unknown serial interval. - shiny::conditionalPanel(condition="input.serialWPKnown == '2'", - shiny::h5("Grid Search Parameters"), - shiny::fluidRow( - shiny::column(4, shiny::textInput(inputId="gridLengthInput", label="Grid length", value="100")), - shiny::column(4, shiny::textInput(inputId="gridShapeInput", label="Max. shape", value="10")), - shiny::column(4, shiny::textInput(inputId="gridScaleInput", label="Max. scale", value="10")) - ), - shiny::fluidRow( - shiny::column(4, shiny::span(shiny::textOutput(outputId="gridLengthWarn"), style="color: red")), - shiny::column(4, shiny::span(shiny::textOutput(outputId="gridShapeWarn"), style="color: red")), - shiny::column(4, shiny::span(shiny::textOutput(outputId="gridScaleWarn"), style="color: red")) - ) - ), - shiny::actionButton(inputId="addWP", label="Add") - ), - # SEQUENTIAL BAYES (seqB). - shinyBS::bsCollapsePanel(title="Sequential Bayes (seqB)", - "This is a description of the method.", - shiny::br(), shiny::br(), + shiny::h3("Estimators"), + # WHITE & PANAGO (WP). + shiny::tags$details( + shiny::tags$summary(shiny::h4("White & Panago (WP)")), + shiny::p("This is a description of the method."), + shiny::br(), + shiny::radioButtons(inputId="serialWPKnown", label="Is the mean serial interval known?", inline=TRUE, choices=list("Yes"=1, "No"=2)), + # Known serial interval. + shiny::conditionalPanel(condition="input.serialWPKnown == '1'", shiny::fluidRow( - shiny::column(8, shiny::textInput(inputId="serialseqBInput", label="Mean Serial Interval")), - shiny::column(4, shiny::selectInput(inputId="serialseqBUnits", label="Time units", choices=list("Days", "Weeks"))) + shiny::column(8, shiny::textInput(inputId="serialWPInput", label="Mean Serial Interval")), + shiny::column(4, shiny::selectInput(inputId="serialWPUnits", label="Time units", choices=list("Days", "Weeks"))) ), - shiny::span(shiny::textOutput(outputId="serialseqBWarn"), style="color: red"), - shiny::textInput(inputId="kappaInput", label=shiny::HTML(paste0("Maximum value of the uniform prior", shiny::tags$sup(id="kappaTool", "[?]"))), value="20"), - shinyBS::bsTooltip(id="kappaTool", "Some information. By default, this is set to 20.", placement="right", trigger="hover"), - shiny::span(shiny::textOutput(outputId="kappaWarn"), style="color: red"), - shiny::actionButton(inputId="addseqB", label="Add") + shiny::span(shiny::textOutput(outputId="serialWPWarn"), style="color: red;") ), - # INCIDENCE DECAY (ID). - shinyBS::bsCollapsePanel(title="Incidence Decay (ID)", - "This is a description of the method.", - shiny::br(), shiny::br(), + # Unknown serial interval. + shiny::conditionalPanel(condition="input.serialWPKnown == '2'", + shiny::h5("Grid Search Parameters"), shiny::fluidRow( - shiny::column(8, shiny::textInput(inputId="serialIDInput", label="Mean Serial Interval")), - shiny::column(4, shiny::selectInput(inputId="serialIDUnits", label="Time units", choices=list("Days", "Weeks"))) + shiny::column(4, shiny::textInput(inputId="gridLengthInput", label="Grid length", value="100")), + shiny::column(4, shiny::textInput(inputId="gridShapeInput", label="Max. shape", value="10")), + shiny::column(4, shiny::textInput(inputId="gridScaleInput", label="Max. scale", value="10")) ), - shiny::span(shiny::textOutput(outputId="serialIDWarn"), style="color: red"), - shiny::actionButton(inputId="addID", label="Add") - ), - # INCIDENCE DECAY & EXPONENTIAL ADJUSTEMENT (IDEA). - shinyBS::bsCollapsePanel(title="Incidence Decay and Exponential Adjustement (IDEA)", - "This is a description of the method.", - shiny::br(), shiny::br(), shiny::fluidRow( - shiny::column(8, shiny::textInput(inputId="serialIDEAInput", label="Mean Serial Interval")), - shiny::column(4, shiny::selectInput(inputId="serialIDEAUnits", label="Time units", choices=list("Days", "Weeks"))) - ), - shiny::span(shiny::textOutput(outputId="serialIDEAWarn"), style="color: red"), - shiny::actionButton(inputId="addIDEA", label="Add") - ) - ) + shiny::column(4, shiny::span(shiny::textOutput(outputId="gridLengthWarn"), style="color: red;")), + shiny::column(4, shiny::span(shiny::textOutput(outputId="gridShapeWarn"), style="color: red;")), + shiny::column(4, shiny::span(shiny::textOutput(outputId="gridScaleWarn"), style="color: red;")) + ) + ), + shiny::actionButton(inputId="addWP", label="Add") + ), + # SEQUENTIAL BAYES (seqB). + shiny::tags$details( + shiny::tags$summary(shiny::h4("Sequential Bayes (seqB)")), + shiny::p("This is a description of the method."), + shiny::br(), + shiny::fluidRow( + shiny::column(8, shiny::textInput(inputId="serialseqBInput", label="Mean Serial Interval")), + shiny::column(4, shiny::selectInput(inputId="serialseqBUnits", label="Time units", choices=list("Days", "Weeks"))) + ), + shiny::span(shiny::textOutput(outputId="serialseqBWarn"), style="color: red;"), + shiny::textInput(inputId="kappaInput", label=shiny::HTML(paste0("Maximum value of the uniform prior", + shiny::tags$sup("[?]", title="This describes the prior belief of R0, and should be set to a higher value if R0 is believed to be larger. (Default: 20)"))), + value="20" + ), + shiny::span(shiny::textOutput(outputId="kappaWarn"), style="color: red;"), + shiny::actionButton(inputId="addseqB", label="Add") + ), + # INCIDENCE DECAY (ID). + shiny::tags$details( + shiny::tags$summary(shiny::h4("Incidence Decay (ID)")), + shiny::p("This is a description of the method."), + shiny::br(), + shiny::fluidRow( + shiny::column(8, shiny::textInput(inputId="serialIDInput", label="Mean Serial Interval")), + shiny::column(4, shiny::selectInput(inputId="serialIDUnits", label="Time units", choices=list("Days", "Weeks"))) + ), + shiny::span(shiny::textOutput(outputId="serialIDWarn"), style="color: red;"), + shiny::actionButton(inputId="addID", label="Add") + ), + # INCIDENCE DECAY & EXPONENTIAL ADJUSTEMENT (IDEA). + shiny::tags$details( + shiny::tags$summary(shiny::h4("Incidence Decay and Exponential Adjustement (IDEA)")), + shiny::p("This is a description of the method."), + shiny::br(), + shiny::fluidRow( + shiny::column(8, shiny::textInput(inputId="serialIDEAInput", label="Mean Serial Interval")), + shiny::column(4, shiny::selectInput(inputId="serialIDEAUnits", label="Time units", choices=list("Days", "Weeks"))) + ), + shiny::span(shiny::textOutput(outputId="serialIDEAWarn"), style="color: red;"), + shiny::actionButton(inputId="addIDEA", label="Add") + ), + shiny::tags$style(type="text/css", "summary { display: list-item; cursor: pointer; }"), + shiny::tags$style(type="text/css", "summary h4 { display: inline; }") ) ) ), @@ -117,12 +123,12 @@ ui <- function() { shiny::mainPanel(id="main", shiny::tabsetPanel(id="tabset", type="tabs", shiny::tabPanel("About", shiny::br(), "Hello"), - shiny::tabPanel("Data", shiny::br(), shiny::dataTableOutput(outputId="dataTable"), shiny::tags$style(type="text/css", '#dataTable tfoot {display:none;}')), + shiny::tabPanel("Data", shiny::br(), shiny::dataTableOutput(outputId="dataTable"), shiny::tags$style(type="text/css", "#dataTable tfoot { display:none; }")), shiny::tabPanel("Estimators", shiny::br(), shiny::dataTableOutput(outputId="estTable"), - shiny::tags$style(type="text/css", "#estTable tfoot {display:none;}"), + shiny::tags$style(type="text/css", "#estTable tfoot { display:none; }"), shiny::downloadButton(outputId="downloadEst", label="Download table as .csv") - ), + ) ) ) ) |