看板 R_Language 關於我們 聯絡資訊
※ 引述《s86116 (hsiuy)》之銘言: : [問題類型]: : 我想用R 都shiny寫一個上傳檔案的app,但是我不知道要怎麼用R 寫出來。 : [軟體熟悉度]: : R基本的語法可以但shiny套件太新,所以很生疏。 : [問題敘述]: : 我想用R 都shiny寫一個上傳檔案的app,但是我不知道要怎麼用R 寫出來。已經把shin y.rstudio.com中gallery提供的程式複製到rstudio了,但還是跑不出來。麻煩各位幫幫 忙了! : [程式範例]: : library(shiny) : ui<-fluidPage() : server<-function(input,output){} : shinyApp(ui=ui,server=server) : 以上的程式是沒有問題的 : 視窗也有跑出來 : 但下面的程式就卡住了 程式來源 http://shiny.rstudio.com/gallery/file-upload.html http://i.imgur.com/fwWA1Sr.jpg http://i.imgur.com/wzHYHhg.jpg : library(shiny) : shinyUI(fluidPage( : titlePanel("Uploading Files"), : sidebarLayout( : sidebarPanel( : fileInput('file1', 'Choose CSV File', : accept=c('text/csv', : 'text/comma -s : '.csv')), : tags$hr(), : checkboxInput('header', 'Header', TRUE), : radioButtons('sep', 'Separator', : c(Comma=',', : Semicolon=';', : Tab='\t'), : ','), : radioButtons('quote', 'Quote', : c(None='', : 'Double Quote'='"', : 'Single Quote'="'"), : '"') : ), : mainPanel( : tableOutput('contents') : ) : ) : )) : library(shiny) : shinyServer(function(input, output) { : output$contents <- renderTable({ : # input$file1 will be NULL initially. After the user selects : # and uploads a file, it will be a data frame with 'name', : # 'size', 'type', and 'datapath' columns. The 'datapath' : # column will contain the local filenames where the data can : # be found. : inFile <- input$file1 : if (is.null(inFile)) : return(NULL) : read.csv(inFile$datapath, header=input$header, sep=input$sep, : quote=input$quote) : }) : }) : [環境敘述]: : 我是用rstudio跑的 : [關鍵字]: : 選擇性,也許未來有用 : 因為我平常不用ptt,這是我朋友的帳號,方便的話可以用line聯絡我,我的ID是jingc hi : ,問題解決了會很有誠意的請你吃個飯,真的拜託大家了! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 27.245.45.28 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1436984106.A.48E.html ※ 編輯: s86116 (27.245.45.28), 07/16/2015 02:18:52 ※ 編輯: s86116 (27.245.45.28), 07/16/2015 02:46:54