[問題] R的actionbutton應用

看板R_Language作者 (shiny)時間6年前 (2017/09/21 13:57), 6年前編輯推噓0(005)
留言5則, 2人參與, 最新討論串1/1
最近打好一串程式是能夠讀取到某資料夾的內容能夠顯示出來 ((以下是能夠自己讀檔的方式 setwd("C:/home/user521/桌面/0519/545") getwd() list.files() # dir() (filenames <- list.files(".", pattern="*.csv")) (quiz.data <- lapply(filenames, read.table)) 但現在想更進一步就是利用shiny方式 然後按按鍵之後就能夠讓檔案自動讀取 想請問該如何更改 以下是Server端 shinyServer(function(input, output) { output$plot1 <- renderPlot({ # Simply accessing input$goButton here makes this reactive # object take a dependency on it. That means when # input$goButton changes, this code will re-execute. input$goButton # Use isolate() to avoid dependency on input$n isolate({ hist(rnorm(input$n)) }) }) }) 想問是不是要從input$goButton 這邊下去做更改 還是render方面該如何做修改 我們想讓按鈕按下去程式才會運作 而不是程式直接運作 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.82.10.206 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1505973444.A.AE3.html

09/21 14:02, , 1F
我不知道我誤會了沒有 actionButton?
09/21 14:02, 1F
※ 編輯: s1032901 (111.82.10.206), 09/21/2017 14:29:45

09/21 14:46, , 2F
observeEvent(input$goBut,{if(is.null(input$goBut))
09/21 14:46, 2F

09/21 14:47, , 3F
return(NULL) isolate({...})... })
09/21 14:47, 3F

09/21 14:49, , 4F
可以偵測到goBut有被執行過再繼續往下做..
09/21 14:49, 4F

09/21 16:08, , 5F
你不小心把分類刪掉囉
09/21 16:08, 5F
文章代碼(AID): #1PmrJ4hZ (R_Language)