3 ms·
You want the data.table [1] implementation of dcast and melt. They support multiple pivot values, inline aggregation, are super fast, and are easy to use compar
by extr 9y ago
You want the data.table [1] implementation of dcast and melt. They support multiple pivot values, inline aggregation, are super fast, and are easy to use compared to trying to wrap your brain around gather/spread. Frankly I think Hadley went a little too far with those tidyr functions, the dcast/melt interfaces he created in reshape2 are much, much easier to intuit and the DT versions are just improvements on that.
[1] https://cran.r-project.org/web/packages/data.table/vignettes/datatable-reshape.html https://cran.r-project.org/web/packages/data.table/vignettes...
- claytonjy 9y agoHuh, I feel the exact opposite here. melt/gather feel very similar, but spread seems like a massive improvement in UI over dcast. Used to be a big data.table fan, until I realized I could read my dplyr code as easily a week later as when I wrote it.