title: In this simple example of R using Shiny package, how would I "subset" and show a specific column of data in an output table?
body: <p>I´m trying to subset a user-generated input matrix in R´s shiny and shinyMatrix packages. I´d like to extract only the values of a selected matrix column (column 3 for example) in the 2nd output table (&quot;table2&quot;) generated by this code. The first output table (&quot;table1&quot;) simply mimics the user inputs which works fine. I´m trying to get the second output table to show only a selected column. This will show me how to subset input data, to implement an additional function waiting in the wings.</p>
  <p>[Side note: when running this the user may add to matrix by clicking on the bottom row of the matrix - a very nice feature! If this input feature doesn´t work well for you, it doesn´t matter for purposes of addressing this question. If you´d like it to work perfectly, then download the latest version of shinyMatrix using devtools::install_github('INWTlab/shiny-matrix'); it won´t be available on CRAN for a while.]</p>
  <pre><code>library(shiny)
  library(shinyMatrix)
  
  m &lt;- diag(3)
  colnames(m) &lt;- 1:3
  rownames(m) &lt;- letters[1:3]
  
  ui &lt;- fluidPage(
    titlePanel(&quot;Demo Matrix Input Field&quot;),
    fluidRow(
      column(6, matrixInput(
                  inputId = &quot;matrix&quot;,
                  label = &quot;Default matrix&quot;,
                  value = m,
                  class = &quot;numeric&quot;,
                  cols = list(names = TRUE,editableNames = TRUE),
                  rows = list(extend = TRUE,names = TRUE,editableNames = TRUE)
                )
      ),
      column(6, tableOutput(&quot;table1&quot;)),
      column(6, tableOutput(&quot;table2&quot;)), 
    )
  )
  
  server &lt;- function(input, output, session) {
    
    output$table1 &lt;- renderTable(input$matrix, rownames = TRUE)
    output$table2 &lt;- renderTable(input$matrix, rownames = TRUE)
  }
  
  shinyApp(ui, server)
  </code></pre>
  <p>Here´s what running this code looks like, I´d like that 2nd table on the bottom right to show, for example, only the column tagged 3, using subsetting:</p>
  <p><a href="https://i.stack.imgur.com/nATdv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nATdv.png" alt="enter image description here" /></a></p>