推 tytony: 完全忘記actionbutton會累加 照cywhale大的方法去改OK了 06/22 23:07
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 42.77.105.153 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1592830017.A.EAF.html
※ 編輯: TreeMan (42.77.105.153 臺灣), 06/22/2020 20:47:42
action btn每按一次+1
所以你的if判別在btn按一次以後都是TRUE
server改成下面這樣就可以正常運作了
server <- function(input, output) {
dd = 0
ee = 0
output$res = renderPrint({
stnid = NULL
if (input$obs.time.ok){stnid = isolate(input$stn)}
if (input$DD > dd){stnid = "DD"; dd <<- dd + 1}
if (input$EE > ee){stnid = "EE"; ee <<- ee + 1}
print(input$DD)
print(dd)
return(stnid)
})
}
不過還是改用observer比較好XD
--