title: Trying to create a loop to export excel files from a list of data
body: <p>I have a list of data (150 student names + class + grade) and I am trying to create Excel sheets by <em>class</em>. I currently have a list of data broken up by class, but I am not able to export them into Excel. </p>
  
  <pre><code>IncomingClasses &lt;- split(Students, Students$Class-Course)
  classes &lt;- names(IncomingClasses)
  
  for (i in seq(classes)){
      assign(classes[i], IncomingClasses[[i]])
      write.xlsx(IncomingClasses[i], file = paste(i, ".xlsx"))
  }
  </code></pre>
  
  <p>But I'm not able to export. The best error message I've gotten is: </p>
  
  <blockquote>
    <ul>
    <li>Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  :   arguments imply differing number of rows: 34,
    44, 15, 17, 16, 18</li>
    </ul>
  </blockquote>
  
  <p>Because I'm supposed to have different rows as there are different students in each class...but it won't create the .xlsx document. </p>
  
  <p>Please help! </p>