title: Add output of for loop to list
body: <p>I have looked at previously asked question about keeping 'for loop' output in a list but I can't seem to apply it to my function.</p>
  
  <p>Maybe someone can give my a clue about what I am doing wrong.</p>
  
  <pre><code>dna_seqs &lt;- list('id1', 'ATGGCAATAACCCCCCGTTTCTACTTCTAGAGGAGAAAAGT', 'id2', 'TCCGTTAAGATATTCTTACGTGTGACGTAGCTATGTATTTTGCAGAGCTGGCGAACGCGTTGAACACTTCACAGATGGT', 'id3', 'AGCTGGTTCCTGCGTGAGCTCGAGACTCGGGATGACAGCTCTTTAAACATAGAGCGGGGGCGTCGAACGGTCGA', 'id4', 'CATCACCGCGATAGGCTGACAAAGGTTTAACATTGAATAGCAAGGCACTTCCGGTCTCAATGAACGGCCGGGAA')
  
  gc_list &lt;- list() 
  count_gc &lt;- function(x) {
    for (i in x) {
      if (startsWith(i, 'id')) {
        gc_list[[i]] &lt;- i
  
      } 
      else {
        seq &lt;- str_to_upper(i)
        seq &lt;- gsub('N', '', seq)
        gc &lt;- str_count(seq, 'G') + str_count(seq, 'C')
        gc_content &lt;- gc / nchar(seq) * 100
        gc_list[[i]] &lt;- gc_content
      }
    } 
  }
  </code></pre>
  
  <p>This function is not appending any elements to the list, which is still empty ?</p>