2014-01-15 204 views
0

我正在尝试用R Shiny构建一个Web应用程序。在我的应用程序中,我想要3个tabPanels。这是我的代码..R闪亮上传错误

tabsetPanel(
     tabPanel("Plot",plotOutput(outputId = "main_plot", height = "500px")), 
     tabPanel("name", 
       h1("example"), 
       conditionalPanel(condition = "input.ta == true", 
        tableOutput('values1'), 
        tags$hr(), 
        verbatimTextOutput('textDisplay') 
       ) 
     ), 
       tabPanel("Frequency Analysis", 
       # h1("example2"), 
       # tableOutput('values2'), 
       #tags$hr(),) 
       )) 

我想上传一个文件,所以我使用fileInput('file1', 'Choose a file t/plain', '.txt'))。 问题是,如果我尝试在第三个tabpanel中放置注释,我的文件不会上传?我不明白原因。你能帮我吗?

回答

0

我真的不明白你的问题,但是这是为我工作:

library(shiny) 
ui <- basicPage(
tabsetPanel(
    tabPanel("Plot", 
      plotOutput(outputId = "main_plot", height = "500px")), 
    tabPanel("name", 
      h1("example"), 
      conditionalPanel(condition = "input.ta == true", 
          tableOutput('values1'), 
          tags$hr(), 
          verbatimTextOutput('textDisplay') 
      ) 
), 
    tabPanel("Frequency Analysis", 
      h1("example2"), 
      sidebarPanel(fileInput("files", "Choose file")), 
      tableOutput('values2'), 
      tags$hr()) 
) 
) 

server <- function(input,output){} 

runApp(list(ui=ui,server=server))