上传数据,调用r脚本和更改数据,使用ShinyApp下载

时间:2017-11-07 19:22:07

标签: r dataframe shiny shiny-server reactive

我想上传数据帧,调用r scipt并应用更新数据帧的函数,然后下载它。谁能帮我?

假设这是我需要调用的函数

Identify_IP(dataframe)
return(dataframe')

这是Shiny App

library(shiny)

source('InflectionP2.R', local = TRUE)

runApp(
  list(
    ui = fluidPage(
      titlePanel("Upload your file"),
      sidebarLayout(
        sidebarPanel(
          fileInput('file1', 'Choose xls file',
                    accept = c(".XLS")),

          actionButton("btn", "Update Table")
        ),

      mainPanel(
        tableOutput('what'))
      )
    ),

    server = function(input, output, session){

      dataframe <- reactive({
        inFile <- input$file1
        if (is.null(input$file1))
          return(NULL)
      Identify_IP(read.table(inFile$datapath, header=input$header, sep=input$sep, quote=input$quote))
        })

      observeEvent(input$btn, {output$what <- renderTable({dataframe})})
          }
)
)

这就是我得到的

  
    

警告:as.data.frame.default出错:无法将类“c(”reactiveExpr“,”reactive“)强制转换为data.frame

  

0 个答案:

没有答案
相关问题