خرید بک لینک

Vote count: 0

I've been leaing Shiny and R for a few days, but I've run against a wall.

My problem is as follows: I want to use radioButtons (input$relStat) so if an option each option runs a different calculation for textOutput. The inputs come from a slider for basicIncome and numeric for childNum.

#ui.R
sliderInput(inputId = "basicIncome", 
              label = "Choose a monthly basic income", 
              value = 600, min = 0, max = 1200, step = 50
  ),

textOutput("aualBasicIncome"),
)

#server.R
aualBasicIncome <- eventReactive(input$updateButton, {
  if ("1" %in% input$relStat)
    renderText({(input$basicIncome*12)+((input$basicIncome*12)*input$childNum)})

  if ("2" %in% input$relStat)
    renderText({(2*(input$basicIncome*12))+((input$basicIncome*12)*input$childNum)})
})

output$aualBasicIncome <- renderText({
  aualBasicIncome()
})

I've tried to give the radioButton into a value. But binary.

If I remove the first if("1") then for one radioButton option nothing is displayed and for the other I get the error "argument 1 (type 'closure') caot be handled by 'cat'".

Any help would be greatly appreciated, thank you and hey, first post.

asked 39 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 18 ارديبهشت 1395 ساعت: 21:42

صفحه بندی