reshape2 is superseded: only changes necessary to keep it on CRANwill be made. We recommend usingtidyr instead.
Reshape2 is a reboot of the reshape package. It’s been over fiveyears since the first release of reshape, and in that time I’ve learneda tremendous amount about R programming, and how to work with data in R.Reshape2 uses that knowledge to make a new package for reshaping datathat is much more focused and much much faster.
This version improves speed at the cost of functionality, so I haverenamed it toreshape2 to avoid causing problems forexisting users. Based on user feedback I may reintroduce some of thesefeatures.
What’s new inreshape2:
considerably faster and more memory efficient thanks to a muchbetter underlying algorithm that uses the power and speed of subsettingto the fullest extent, in most cases only making a single copy of thedata.
cast is replaced by two functions depending on the output type:dcast produces data frames, andacast producesmatrices/arrays.
multidimensional margins are now possible:grand_rowandgrand_col have been dropped: now the name of the marginrefers to the variable that has its value set to (all).
some features have been removed such as the| castoperator, and the ability to return multiple values from an aggregationfunction. I’m reasonably sure both these operations are better performedby plyr.
a new cast syntax which allows you to reshape based on functionsof variables (based on the same underlying syntax as plyr):
better development practices like namespaces and tests.
the functionmelt now names the columns of itsreturned data frameVar1,Var2, …,VarN instead ofX1,X2, …,XN.
the argumentvariable.name ofmeltreplaces the old argumentvariable_name.
Initial benchmarking has shownmelt to be up to 10xfaster, pure reshapingcast up to 100x faster, andaggregatingcast() up to 10x faster.
This work has been generously supported by BD (Becton Dickinson).