[問題] shiny updateSelectInput

看板R_Language作者 (就這樣吧)時間10年前 (2015/11/21 22:03), 10年前編輯推噓0(007)
留言7則, 2人參與, 最新討論串1/1
[問題類型]: 程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來) [軟體熟悉度]: 入門(寫過其他程式,只是對語法不熟悉) [問題敘述]: 這個程式主要要 1.上傳檔案 2.按上傳檔案的column名稱做變項名稱 3.把變項名稱做為selectInput的選項 4.以selectInput選擇要使用的變項 [程式範例]: https://gist.github.com/4a9d6b27bde066c72258 目前我可以成功上傳檔案,但是無法成功把上傳檔案的標題列作為要選擇的選項 看了shiny網頁的範例還是不太能掌握該怎麼使用updateSelectInput [環境敘述]: R version 3.2.2 (2015-08-14) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.11.1 (El Capitan) shiny_0.12.2 [關鍵字]: 選擇性,也許未來有用 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.230.223.125 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1448114634.A.015.html ※ 編輯: DrRd (36.230.223.125), 11/21/2015 22:04:39

11/21 22:40, , 1F
server <- function(input, output, session)
11/21 22:40, 1F

11/21 22:41, , 2F
observe({updateSelectInput(session, "inID", choices=
11/21 22:41, 2F

11/21 22:42, , 3F
names(data())) })
11/21 22:42, 3F

11/22 11:46, , 4F
感謝,但是目前出現的錯誤訊息「Unhandled error in observe
11/22 11:46, 4F

11/22 11:47, , 5F
cannot coerce type 'closure' to vector of type 'list'
11/22 11:47, 5F

11/22 11:50, , 6F
看來要解決另一個問題
11/22 11:50, 6F

11/22 11:53, , 7F
解決了!感恩!
11/22 11:53, 7F
文章代碼(AID): #1MK7dA0L (R_Language)
文章代碼(AID): #1MK7dA0L (R_Language)