title: How to randomly assign each observation to one of two labels
body: <p>I have a data matrix in R as follows: </p>
  
  <pre><code>     [,1] [,2]
  [1,]    1    4
  [2,]    1    3
  [3,]    0    4
  [4,]    5    1
  [5,]    6    2
  [6,]    4    0
  </code></pre>
  
  <p>Now I want to randomly assign each observation to either 1 or 0 cluster. Basically I am trying to do Kmeans and before that I wanted to initialise each observation to some cluster. </p>
  
  <p>I want to use sample function in R. But I am not sure how sample would give this. Sample function is to get a sample from a set. </p>
  
  <p>Can someone guide?</p>