2017-12-25 7 views
1

나는 하나의 출력이 다른 출력에서 ​​사용될 수 있는지 의문이있다? 내 출력 $ 조건빛나는 서버에서 하나의 출력이 다른 출력 내부에서 사용되도록

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 
     } 
     }) 
+0

나는 이전과 같은 성가신 문제가 있었지만 해결하지 못했습니다. 아무도 대답이 없으면 적어도 나에게 가치있는 현상금입니다. 나는이 포스트를 고대한다. – InfiniteFlashChess

답변

1

사용에 사용되는 출력 $의 mysum의 결과를 사용하고자하는 값이 어떤 output에서 사용할 수있는 reactive expression. 예를 들어 : 할 경우

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() 
}) 
+0

매우 유용한 유용한 예입니다. – InfiniteFlashChess

+0

@nicola 대단히 감사합니다. 그것은 작동합니다! –

+0

@KienWei 도움이 되서 기쁩니다. 유용하다고 생각되면 대답을 수락하십시오. – nicola

0

의는 내가 출력 $의 mysum의 조건 인자로이 값을 사용하려면, 내가 2015으로 입력 $ 년에서 값 속도를 얻을 말한다. 너무 반응적으로 할 수 있습니까?

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")) 
    } 
})