我有一个问题是一个输出是否可用于另一个输出?我希望使用输出$ mysum的结果在我的输出$ condition中使用
output$condition= renderText({
if (output$mysum <20) {
print("The sum of the time is less than 20")
}
})
output$mysum <- renderText({
x=input$number
x=x+1
}
})
使用reactive expression,其值可以在任何output
中使用。例如:
sumone <- reactive({
input$number+1
})
output$condition <- renderText({
if (sumone() < 20) {
print("The sum of the time is less than 20")
}
})
output$mysum <- renderText({
sumone()
})
如果让我说从2015年输入$ year获得一个值速度,那么我想将此值用作输出$ mysum的条件因子。它可以用反应来完成吗?
output$condition <- renderText({
if(input$year==2015){
speed=as.numeric(sqldf("select ave_speed from newdataset where [month]=12
AND [day]=30 AND [regionid]=16"))
}
}
})
output$mysum <- renderText({
if(speed<30){
month=as.numeric(sqldf("select month from newdataset where [month]=12 AND
[day]=30 AND [regionid]=16"))
}
})