title: How to convert For loop to apply
body: <p>How do I convert the below nested For loop to an Apply?</p>
  
  <pre><code>for(i in 1:length(vList$Subgroup.Number))
  {
    for(j in 1:length(viol_grp))
     {
      viol_List[[j]] &lt;- vList[which(vList$Subgroup.Number==viol_grp[j]), ]
     }
  }
  </code></pre>