title: How to loop through an array in pairs?
body: <p>I have a 1000x1 vector (1000 rows and 1 column). I want to get elements in pairs (row 1 and row 2, row 3 and row 4, row 5 and row 6, etc.)</p>
  
  <p>Here's what I have so far</p>
  
  <pre><code>for (j in 1: ncol(total_loci)){
      for (i in 1: sample_size){
      # a pair
      genotype[i]&lt;- paste(total_loci[i, j], total_loci[i+1,j], sep="")
      }
  }
  </code></pre>
  
  <p>Genotype should thus be a 500x1 vector (500 rows and 1 column) containing the genotype. Assume that my for-loops are correct. I think my I needs to skip every other index -- so my <code>i</code> should start at 1 then 3, 5, 7, 9, etc. The variable <code>total_loci</code> is of class data frame.</p>