title: r - Filtering rows of a data.frame using a index
body: <p>I have a data.frame, called <code>sonar</code>. The content of the first row is: </p>
  
  <p><img src="https://i.stack.imgur.com/o82bt.png" alt="first row of the data.frame"></p>
  
  <p>Also, I have a vector of index; <code>index = c(1:N)</code>. I need to sample index and then split it in 5 parts. Then, I need to take 5 groups of rows, each group have the rows of the data.frame given by a part of the vector index.</p>
  
  <p>I have done the following:</p>
  
  <pre><code>partitions = split(index, cut(seq_along(index), 5, labels = F))
  </code></pre>
  
  <p>So I have my parts in <code>partitions[1]</code>, <code>partitions[2]</code>... These are lists.</p>
  
  <p>What I have to do now? </p>