2

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 Answers 2

8

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah, that along the lines of what I was thinking too, thanks!
-3

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.