R Shiny - Numeric Input without Selectors

前端 未结 2 2019
梦如初夏
梦如初夏 2021-01-22 05:38

Is there a way to have a numeric input without the selectors? Every time the slider is pressed, all calculation in my app occur, so it could get choked up by a user easily. Poss

2条回答
  •  后悔当初
    2021-01-22 06:22

    You could use a textInput and have a reactive() that converts it to numeric so, for example, if numInput is the name of your textInput:

    In server.R:

    numConv <- reactive({as.numeric(input$numInput)})
    

    Then anywhere that was referring to input$numInput change to numConv(). You can add any code you want the reactive, so you could do additional checks to make sure that the user is entering a valid input before it triggers all the other calculations in your app.

提交回复
热议问题