0
`if (interactive()) {

ui <- fluidPage(
numericInput("obs", "Observations:", 10, min = 1, max = 100),
numericInput("obs1", "Observations1:", 10, min = 1, max = 100),
textInput("final", "Sum")
)
server <- function(input, output) { 

}
shinyApp(ui, server)
}

`

How do I use the inputs from Observations and Observations1 and paste the value in the Sum.

I tried, input$obs + input$obs1 in server and it didn't work.

Thanks!

Harryy
  • 41
  • 9

1 Answers1

1

You need to understand the difference between your inputs and your outputs. You should watch the first 30-45 mins of this video. But I believe the below will do what you have asked.

ui.R

shinyUI(fluidPage(

  numericInput("obs", "Observations:", 10, min = 1, max = 100),
  numericInput("obs1", "Observations1:", 10, min = 1, max = 100),
  textOutput("sum") 
))

server.R

shinyServer(function(input, output) {
    output$sum <- renderText({input$obs + input$obs1})

})
DataJack
  • 341
  • 2
  • 13