title: adding data input into a empty data frame in R using shiny
body: <p>I am fairly new to shiny and R I am trying to make a user interface for the amount of money used in different companies. I made a empty data frame, and was trying to add the input from the user to the data frame, but the app crashes. Any assistance would be great please! </p>
  
  <pre><code>library(shiny)
  
  df &lt;- data.frame(Company = character(), Goods = character(),GoodsType = character(), 
               Number = integer(), Cost = double(), stringsAsFactors = FALSE)
  
  ui &lt;- fluidPage(
       titlePanel("Cost tool "),
  
        sidebarLayout(
          sidebarPanel(
            selectInput(inputId = "Company", label = "Company",
                        choices = list("Company 1", "Company 2 " , " Company 3 "), selected = ""),
  
            radioButtons(inputId = "Goods", label = "Select bought goods",inline = TRUE,
                 choices = list("Food", "Electronics","Books"), selected = ""),
  
            selectInput(inputId = "GoodsType", label = " Types of Goods",
                choices = list(" Milk", "Eggs" , "vegetables" ,"Games Consoles",
                 "headphones", "phones", "mystery","fiction","horror"), selected = ""),
  
            textInput(inputId = "Number", label = " How many?: ",
                      value = ""),
  
             textInput(inputId = "Cost", label = "Cost",
                      value = ""),
  
            actionButton("submit","Submit")
  
  
    ),
      mainPanel(
       dataTableOutput("CostTable")
      )
    )
  )
  
  
  server &lt;- function(input, output){
  
   observeEvent(input$submit, {
  
   df[1,] &lt;- data.frame(input$Company,input$Goods,input$GoodsType, input$Number, input$Cost)
  
  
     })
  
  
  }
  
  shinyApp(ui = ui, server = server) 
  </code></pre>