2017-02-10 11 views
0
からシャイニーnumericInputを守る

私のスーパー素晴らしい光沢のあるアプリは、次のようになります。B用負の数

library(shiny) 

ui <- fluidPage(
    numericInput(inputId = "A", label = "A", value = 5, step = 1), 
    uiOutput("slider"), 
    textOutput(outputId = "value") 
) 

server <- function(input, output) { 
    output$value <- renderText(paste0("A + B = ", input$A + input$B)) 
    output$slider <- renderUI({ 
     sliderInput(inputId = "B", label = "B", min = 0, max = 2*input$A, value = 5) 
    }) 
} 

shinyApp(ui = ui, server = server) 

sliderInputは(HubertL & BigDataScientistにS/O)動的であるが、今、私は否定的からAへの入力を保護する必要があります数字。

これをどのように達成できますか?

+0

'numericInput'の' min'値は、 'numericInput(inputId =" A "、label =" A "、value = 5、 step = 1、min = 0) ' – NicE

答えて

0

numericInput()には、引数をだけ追加する必要があります。その後、ユーザーは0を越えることができなくなります。