Create an input control for numeric range values
1 2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | if (interactive()) {
library(shiny)
library(shinydashboard)
shinyApp(
ui = fluidPage({
title = "Num Range Input"
fluidRow(
numRangeInput("num", label = "数值:", start = 12, end = 20000),
sliderInput("obs", "Number of observations:", min = 0, max = 2000, value = c(13,1900)),
actionButton("update", label = "Update"),
verbatimTextOutput("value1"),
verbatimTextOutput("value2")
)
}),
server = function(input, output, session) {
output$value1 <- renderText({
paste(input$num_1,input$num_2)
})
observeEvent(input$update, {
updatenumRangeInput(session, "num", range = 1, value = list(input$obs[[1]]))
updatenumRangeInput(session, "num", range = 2,value = list(input$obs[[2]]))
})
output$value2 <- renderText({
input$obs
})
}
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.