title: Get a random column from R matrix
body: <p>In R language, I defined a matrix this way:</p>
  
  <pre><code>data &lt;- matrix(c("A","B","C","D","E","F"), nrow = 2)
  </code></pre>
  
  <p>This gives me something like this:</p>
  
  <pre><code>"A" | "C" | "E"
  "B" | "D" | "F"
  </code></pre>
  
  <p>now, How do I get a random column of the matrix?</p>
  
  <p>If I do:</p>
  
  <pre><code>sample(x = data, n = 2)
  </code></pre>
  
  <p>I get random elements from all around the matrix, like "A" and "F". What I want is to get a column like "A" and "B", or "C" and "D" or "E" and "F"</p>
  
  <p>I am new to R so any help is really apreciated</p>