title: Saving vectors of different lengths in a matrix/data frame
body: <p>I have a numeric called area of length 166860. This consists of 412 different elements, most of length 405 and some of length 809. I have their start and end ids.</p>
  
  <p>My goal is to extract them and put them in a matrix/data frame with 412 columns</p>
  
  <p>Right now, I'm trying this code:</p>
  
  <pre><code>m = matrix(NA,ncol=412, nrow=809)
  for (j in 1:412){
  temp.start = start.ids[j]
  temp.end = end.ids[j]
  m[,j] = area[temp.start:temp.end]
  }
  </code></pre>
  
  <p>But I just end up with this error message:</p>
  
  <p>"Error in m[, j] = area[temp.start:temp.end] : 
    number of items to replace is not a multiple of replacement length"</p>