title: R/ Shiny read csv as data and make some if-then-else statement and show the results?
body: <p>I am not sure if it makes sense. But I am looking for some help with using Shiny. Here is what I need, first, read some csv file on the shiny server. Second, by clicking a button as an if-then-else statement proceeds each observation's value of data sorted somehow.</p>
  
  <p>csv:</p>
  
  <pre><code>no,money,penalty
  1,10000,1000
  2,20000,1000
  3,30000,2000
  </code></pre>
  
  <p>if-then-else statement:</p>
  
  <pre><code>if money &gt;10000 then 1 else 0
  if penalty &gt;1000 then 1 else 0
  </code></pre>
  
  <p>here is the r-shiny code I am working on:</p>
  
  <pre><code># Load packages
  library(shiny)
  
  if (interactive()) {
  
  ui &lt;- fluidPage(
    sidebarLayout(
      sidebarPanel(
        fileInput("file1", "Choose CSV File",
          accept = c(
            "text/csv",
            "text/comma-separated-values,text/plain",
            ".csv")
          ),
        tags$hr(),
        checkboxInput("header", "Header", TRUE)
      ),
      mainPanel(
        tableOutput("contents")
      )
    )
  )
  
  server &lt;- function(input, output) {
    output$contents &lt;- renderTable({
      # input$file1 will be NULL initially. After the user selects
      # and uploads a file, it will be a data frame with 'name',
      # 'size', 'type', and 'datapath' columns. The 'datapath'
      # column will contain the local filenames where the data can
      # be found.
      inFile &lt;- input$file1
  
      if (is.null(inFile))
        return(NULL)
  
      read.csv(inFile$datapath, header = input$header)
    })
  }
  
  shinyApp(ui, server)
  }
  </code></pre>
  
  <p>Thank you for your help ahead.</p>