闪亮的服务器输出if语句错误

时间:2017-02-10 16:40:33

标签: r if-statement shiny

我在以下代码中获得missing value where TRUE/FALSE needed,但我不知道为什么。

output$Strength<-renderText( if(input$Motiv>=((input$Tempt-input$Rew)/(input$Tempt-input$Pun))){ "Strong!" }else{ "Weak!" } )

Shiny App的其余部分运行得很好。

1 个答案:

答案 0 :(得分:0)

尝试..

output$Strength<-renderText(
    if(input$Motiv[1] >= ((input$Tempt[1]-input$Rew[1])/(input$Tempt[1]-input$Pun[1]))){
      "Strong!"
    }else{
      "Weak!"
    }
)