title: How can I split a CSV file into small chunks?
body: <p>I am trying to figure out how to split a CSV file into small chunks. I want to split by any number or rows.  Maybe 20, 1,000, or whatever.  </p>
  
  <pre><code>setwd("C:/Users/my_path/test_folder/") 
  mydata = read.csv("NHLData.csv") 
  
  
  split(mydata, ceiling(seq_along(mydata)/20)) 
  </code></pre>
  
  <p>Error: Warning message: In split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) : data length is not a multiple of split variable</p>
  
  <p>I also tried this. </p>
  
  <pre><code>split(mydata, ceiling(seq_along(mydata)/(length(mydata)/20)))
  </code></pre>
  
  <p>Same Error: Warning message: In split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) : data length is not a multiple of split variable</p>
  
  <p>I Googled for those ideas.  I didn't really find anything else that was useful.  This must be pretty simple, right.</p>