data.table Reshaping, stacking and splitting

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


The official vignette, "Efficient reshaping using data.tables", is the best introduction to this topic.

Many reshaping tasks require moving between long and wide formats:

  • Wide data is data with each column representing a seperate variable, and rows representing seperate observations
  • Long data is data with the form ID | variable | value, where each row representing a observation-variable pair

Got any data.table Question?