facets-suite icon indicating copy to clipboard operation
facets-suite copied to clipboard

rbindList vs rbind

Open arichards2564 opened this issue 4 years ago • 1 comments

https://github.com/mskcc/facets-suite/blob/b197695e0328bb81f778af53c3b9682b73c2dcba/annotate-maf-wrapper.R#L107

I'm not sure if it was the version of R but I was getting an error with this version: Error in rbindlist(output_maf, maf[!which(maf$Tumor_Sample_Barcode %in% : Input is data.table but should be a plain list of items to be stacked

I changed it to "rbind" instead of "rbindlist" and it worked fine.

arichards2564 avatar Mar 12 '20 06:03 arichards2564

(Received an e-mail)

The input is incorrect for rbindlist() I suspect---it must be a list.

Review the following: https://www.rdocumentation.org/packages/data.table/versions/1.12.8/topics/rbindlist https://github.com/Rdatatable/data.table/issues/1428

Take the following example:

> library(data.table)
> foo = data.table()
> foo
Null data.table (0 rows and 0 cols)
> rbindlist(foo)
Error in rbindlist(foo) : 
  Input is data.table but should be a plain list of items to be stacked
> rbindlist(list(foo)) 
Null data.table (0 rows and 0 cols)

This would be a perfect pull request for @arichards2564 ;)

FWIW, facets-suite should be using functions from the data.table package for performance, e.g. fwrite() instead of write.table().

evanbiederstedt avatar Mar 12 '20 22:03 evanbiederstedt