[R] memory growth with rbind and lapply

Jack Tanner ihok at hotmail.com
Sun May 13 04:06:19 CEST 2012


This version of my code makes the R process consume unreasonable amounts of RAM:

  datf <- rbind(lapply(mylist, function(item) {
      with(item, data.frame(col1, col2, col3))
    }))

This version works fine:

  datf <- lapply(mylist, function(item) {
      with(item, data.frame(col1, col2, col3))
    })
  datf <- do.call(rbind, datf)

Is this to be expected?



More information about the R-help mailing list