我有一个闪亮的应用程序,我的服务器功能如下所示:
shinyServer(function(input, output, session) {
filedata <- reactive({
infile <- input$file1
if (is.null(infile)) {
return(NULL)
}
myDF <- fread(infile$datapath)
return(myDF)
# Return the requested graph
graphInput <- reactive({
switch(input$graph,
"Plot1" = plot1,
"Plot2" = plot2)
})
output$selected_graph <- renderPlot({
paste(input$graph)
})
output$plot1 <- renderPlot({
#fill in code to create a plot1
})
output$plot2 <- renderPlot({
#fill in code to create plot2
})
UI 功能如下所示:
shinyUI(pageWithSidebar(
headerPanel("CSV Viewer"),
sidebarPanel(
fileInput('file1', 'Choose CSV File',
accept=c('text/csv', 'text/comma-separated-values,text/plain', '.csv')),
selectInput("graph", "Choose a graph to view:",
choices = c("Plot1", "Plot2"))
submitButton("Update View")
),#end of sidebar panel
mainPanel(
tabsetPanel(
tabPanel("Graph Viewer", plotOutput("selected_graph"))
)
我无法使选定的绘图显示在屏幕上。当我从下拉菜单中进行选择并单击“更新视图”按钮时,应用程序不显示绘图。它不显示错误消息。它什么也没显示。
我怎样才能解决这个问题?