title: Selecting the nth character within a loop using R
body: <p>For context, I am writing a code in R that selects out the most common character from a list of strings - determining the most common character in the first position of each string, and so on. To start I am running a loop within a loop to save each character to a list for use later.</p>
  
  <p>I am trying to use the head function to select out each character along the string, which of course is giving me the first character, first two characters, and so on when what I want is the first, second, third, etc. character to be saved to the list.</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>Store &lt;- list()
  
  for (j in (1:SequenceNumber)){
    SequenceLength &lt;- length(Sequences[[j]])
  
  for (i in (1:SequenceLength)){
    Store[[length(Store)+1]] &lt;- head(Sequences[[j]], n=i)
  }
  }
  </code></pre>
  
  <p>So in summary, I am wondering what (probably extremely simple) solution there might be to select the nth element <em>only</em> within a loop using R.</p>
  
  <p>I have tried looking around for a solution, but can only find results selecting out a specified range (for example, the first five results), instead of the nth result.</p>