[问题] shiny相关问题

楼主: s86116 (hsiuy)   2015-07-16 02:03:32
[问题类型]:
我想用R 都shiny写一个上传档案的app,但是我不知道要怎么用R 写出来。
[软件熟悉度]:
R基本的语法可以但shiny套件太新,所以很生疏。
[问题叙述]:
我想用R 都shiny写一个上传档案的app,但是我不知道要怎么用R 写出来。已经把shiny.
rstudio.com中gallery提供的程式复制到rstudio了,但还是跑不出来。麻烦各位帮帮忙
了!
[程式范例]:
library(shiny)
ui<-fluidPage()
server<-function(input,output){}
shinyApp(ui=ui,server=server)
以上的程式是没有问题的
视窗也有跑出来
但下面的程式就卡住了
library(shiny)
shinyUI(fluidPage(
titlePanel("Uploading Files"),
sidebarLayout(
sidebarPanel(
fileInput('file1', 'Choose CSV File',
accept=c('text/csv',
'text/comma-separated-values,text/plain',
'.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是jingchi
,问题解决了会很有诚意的请你吃个饭,真的拜托大家了!
作者: Wush978 (拒看低质媒体)   2015-07-16 02:10:00
你要确实把ui.R / server.R 的内容贴上去

Links booklink

Contact Us: admin [ a t ] ucptt.com