看板 R_Language 關於我們 聯絡資訊
會錯誤是因為你用unique,沒有取最小跟最大出來 請直接用range就好 amount = observe({ input$brand if (input$brand=="all"){ val = range(df$amount) } else{ val = range(df$amount[df$brand==input$brand]) } updateSliderInput(session, "amount", min = val[1], max = val[2]) }) ※ 引述《ardodo (米蟲)》之銘言: : ※ 引述《celestialgod (攸藍)》之銘言: : : 一樣的方法去改,再server裡面加這個就好 : : amount = observe({ : : input$brand : : if (input$brand=="all"){ : : val = c(1, 20) : : } else if (input$brand=="s"){ : : val = c(4, 8) : : } else if (input$brand=="w"){ : : val = c(3, 10) : : } : : updateSliderInput(session, "amount", min = val[1], max = val[2]) : : }) : 照著版大的指令修改後,目前我sliderinput的範圍在我選擇brand==w or brand==s : 的情況下是正常的,但是我如果選擇brand==all,範圍變成10-20,這是錯誤的 : 不知道我應該從哪邊修改呢? : 以下是我的code : http://pastebin.com/MqjwBJBF -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.205.27.107 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1437383583.A.BC0.html
ardodo: 感謝版主幫忙,問題已解決 07/20 17:40
ardodo: code分享: http://pastebin.com/MqjwBJBF\ 07/20 17:41