如何在上传的数据表中添加新行

时间:2015-12-21 19:31:18

标签: r shiny import-from-csv

我想设计一个基本的生产计划功能。主要是,我尝试用闪亮的方式做我在excel做的事情。我有一个由用户上传的文件。然后,用户应调整降低库存水平的新数量。 - 一天,多次调整 - *日期取自系统日期。 *应显示新行。 以下是示例数据:http://www.filedropper.com/data2_2

enter image description here

library(shiny)

shinyServer(function(input, output) {

  output$table1 <- renderTable({

    if (is.null(input$file1))
      return(NULL)
    read.csv(input$file1$datapath, header=TRUE, sep=";",
             quote='')

    })

  addData <- observe({
    if(input$action > 0) {
      f (is.null(input$file1))
      return(NULL)
      read.csv(input$file1$datapath, header=TRUE, sep=";",
               quote='')

      `uploadedfile1` <- read.csv(input$file1$datapath, sep=";")
      uploadedfile2 <- uploadedfile1

      safetystock <- 585

      newLine <- isolate(c(Sys.Date(), "provided by file", input$spotQuantity, inventory, safetystock, Location2))

      isolate(uploadedfile2Plot <- rbind(as.matrix(uploadedfile2), unlist(newLine)))
      uploadedfile2 Plot
    }
  })
  })


shinyUI(fluidPage(

  sidebarLayout(
    sidebarPanel(

      fileInput('file1', 'Choose File', accept=c('text/csv', 'text/comma-separated-values,text/plain', '.csv')),
      numericInput("Quantity", "Enter Quantity",value=0),
      actionButton("action","Confirm")
    ),

    # Show a plot of the generated distribution
    mainPanel(
      tableOutput("table1")

    )
  )
))

0 个答案:

没有答案