Hi all,
I'm new-ish to R Shiny. I'm trying to create an app and I wanted just one of my sliders to have a gradient, so for values close to 0 I want the slider to be red, but close to 1 to be green. My code is as follows:
ui <- fluidPage(
titlePanel("Return Curve Estimation"),
fileInput("data", label = "File input", accept = c(".csv", ".rds", ".txt"),
buttonLabel = "Browse...", placeholder = "No file selected"),
uiOutput("select_column_x"),
uiOutput("select_column_y"),
hr(),
sidebarLayout(
sidebarPanel(
selectInput("analysis", "Choose Analysis:",
choices = c("Exploratory Data Analysis", "Return Curve Estimation", "Angular Dependence Function")),
uiOutput("rcinputs")
),
mainPanel(
uiOutput("analysis")
)
)
)
server <- function(input, output, session) {
output$rcinputs <- renderUI({
if (input$analysis == "Return Curve Estimation") {
tagList(
withMathJax(),
sliderInput("lengthw", "Number of angles \\(\\omega\\)",
min = 101, max = 1001, step = 100, value = 101),
hr(),
numericInput("probability", "Curve survival probability \\(p\\)", value = 0.001),
hr(),
selectInput("method", "Method to estimate \\(\\lambda(\\omega)\\)",
choices = list("hill", "cl")),
hr(),
sliderInput("qmarg1", "Marginal quantile for the Marginal transformation for the first variable",
min = 0.01, max = 0.99, step = 0.01, value = 0.95),
sliderInput("qmarg2", "Marginal quantile for the Marginal transformation for the second variable",
min = 0.01, max = 0.99, step = 0.01, value = 0.95),
selectInput("constrainedshape", "Constrained the shape parameter of the GPD fit",
choices = c(TRUE, FALSE)),
hr(),
sliderInput("q", "Marginal quantile for the min-projection variable and/or Hill estimator",
min = 0.01, max = 0.99, step = 0.01, value = 0.95),
sliderInput("qalphas1", "Marginal quantile used for the conditional extremes model for the first variable",
min = 0.01, max = 0.99, step = 0.01, value = 0.95),
sliderInput("qalphas2", "Marginal quantile used for the conditional extremes model for the second variable",
min = 0.01, max = 0.99, step = 0.01, value = 0.95),
hr(),
numericInput("k", "Polynomial degree", value = 7),
hr(),
selectInput("constrained", "Incorporate knowledge of conditional extremes parameters",
choices = c(FALSE, TRUE)),
hr(),
numericInput("tol", "Convergence tolerance for the composite maximum likelihood procedure",
value = 0.0001),
hr(),
numericInput("parinit", "Initial values for the parameters \\(\\beta\\)",
value = 0)
)
}
else if(input$analysis == "Angular Dependence Function") {
...
})
...
}
I wanted the slider for "qmarg1" to have this gradient. Many thanks