[問題] shiny-用戶端輸入資料匯出dataframe

看板R_Language作者 (日日夜夜)時間9年前 (2016/04/01 03:22), 9年前編輯推噓1(106)
留言7則, 2人參與, 最新討論串1/1
[問題類型]: 程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來) [軟體熟悉度]: 入門(寫過其他程式,只是對語法不熟悉) [問題敘述]: 各位安安~ 小弟最近在用shiny寫一個線上分析的示範程式 過程中需要讓使用者能夠自行輸入(或用選單選擇)數字及文字 舉例來說: 學號 身高 體重 性別 喜歡的電影 ... 我理想中的形式有點像下面三種的結合 1. handsontable example: https://github.com/jrowen/rhandsontable 或是 shiny::runGitHub("jrowen/rhandsontable", subdir = "inst/examples/rhandsontable_portfolio") 如handsontable範例中factor的呈現方式最好─像是selectizeInput選單 缺點:使用者無法新增或減少列數 2. shinyTable https://github.com/trestletech/shinyTable example: http://pastie.org/10781067 或是 runApp(system.file("examples/01-simple", package="shinyTable")) 我想要的互動形式跟這個package比較像 他能夠回傳dataframe或matrix 但是不希望像他用輸入表格的方式(如範例上方表格) 而是用shiny的widgets像是checkboxInput, selectizeInput賦值 再用actionButton返回 缺點同上 3. shinyIncubator example: http://pastie.org/10781069 像這裡的matrixInput範例就能夠用+/-號來新增減少列數 但是!!! 他沒辦法用character 也不能回傳dataframe...orz 總而言之 我想呈現的東西在這裡都能找到一部份 但我想了很~~久還是不知道怎麼整合... 希望有大大可以幫忙 感恩~ 如果我研究出來了會再來更新的 *補充: 因為是用widgets來pass value 只有一列的時候數值會跟著input變動 但若我新增一列後 第一列的值應該要固定 變成第二列的值跟著input變動 *10:30更新 已解決 參考範例:http://pastie.org/10781381 [環境敘述]: R version 3.2.1 (2015-06-18) Platform: i386-w64-mingw32/i386 (32-bit) Running under: Windows 8 x64 (build 9200) locale: [1] LC_COLLATE=Chinese (Traditional)_Taiwan.950 LC_CTYPE=Chinese (Traditional)_Taiwan.950 [3] LC_MONETARY=Chinese (Traditional)_Taiwan.950 LC_NUMERIC=C [5] LC_TIME=Chinese (Traditional)_Taiwan.950 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] shinyTable_0.1.0 quantmod_0.4-5 TTR_0.23-0 xts_0.9-7 [5] zoo_1.7-12 reshape2_1.4.1 data.table_1.9.6 metricsgraphics_0.9.0 [9] rhandsontable_0.3.0.2 shiny_0.13.2.9003 devtools_1.10.0.9000 loaded via a namespace (and not attached): [1] Rcpp_0.12.3 magrittr_1.5 quantstrat_0.8.2 xtable_1.8-2 lattice_0.20-31 [6] R6_2.1.2 stringr_1.0.0 plyr_1.8.3 httr_1.1.0 tools_3.2.1 [11] grid_3.2.1 withr_1.0.1 htmltools_0.3.5 yaml_2.1.13 digest_0.6.9 [16] blotter_0.9.1644 htmlwidgets_0.6 rsconnect_0.4.1.4 memoise_1.0.0 mime_0.4 [21] stringi_1.0-1 jsonlite_0.9.19 httpuv_1.3.3 chron_2.3-47 [關鍵字]: shiny, dataframe, interactive -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 132.208.73.221 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1459452162.A.659.html ※ 編輯: naturalsmen (132.208.73.221), 04/01/2016 03:34:57 ※ 編輯: naturalsmen (132.208.73.221), 04/01/2016 03:35:42 ※ 編輯: naturalsmen (132.208.73.221), 04/01/2016 08:51:07

04/01 09:46, , 1F
就像matrixInput一樣,自己寫個wellPanel,附上欄位用
04/01 09:46, 1F

04/01 09:47, , 2F
textInput或者tags$input(id... 再把欄位中資料rbind回來
04/01 09:47, 2F

04/01 09:49, , 3F
重新renderTable(ps actionButton應該可以用icon 如果要
04/01 09:49, 3F

04/01 09:57, , 4F
設計+的話..如原code也大概如此https://goo.gl/MtwLQK
04/01 09:57, 4F

04/01 10:29, , 5F
感謝c大 剛剛用了一個很直覺的方式寫出來了...
04/01 10:29, 5F

04/01 10:29, , 6F
※ 編輯: naturalsmen (132.208.73.221), 04/01/2016 10:30:38

04/01 10:32, , 7F
剛剛在看作者source code時突然想到XDD
04/01 10:32, 7F
文章代碼(AID): #1M_Na2PP (R_Language)
文章代碼(AID): #1M_Na2PP (R_Language)