2
votes

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. Possibly use a text input and cast it as numeric maybe?

Any other ideas?

2

2 Answers

7
votes

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.

-3
votes

In your ui.R file, use inputs like the following:

shinyUI(pageWithSidebar(
    sidebarPanel(
        textInput("text", "Enter Text:", "Default Text"),
        numericInput("num1", "Please Enter a Number:", 42)
      )
))

Hope that helps.