Reshape is anR package for flexibly restructuring and aggregating data. It is available on all platforms supported by R (Linux, OS X, Windows, ...). The current version is 0.8.

Reshape (hopefully) makes it easy to do what you have been struggling to do with tapply, by, aggregate, xtabs, apply and summarise. It is also useful for getting your data into the correct structure for lattice or ggplot plots.

Along with ggplot, reshape won the 2006 John Chambers Award for Statistical Computing. ggplot provides a new way of making plots in R, based on the grammar of graphics.

How to install

Reshape is available from CRAN so you can install it using the following R command:



The best place to start is “Reshaping data with the reshape package”, published in the journal of statistical software.

You might also be interested in the slides (pdf, 140k) and paper (pdf, 260k) I presented at Directions in Statistical Computing 2005. Please note that after the publication of this paper I changed reshape to cast, and deshape to melt to avoid a name conflict with base R. An updated version of this paper appeared in the ASA Statistical Computing and Graphics Newsletter (PDF).

In June 2006, I presented Data checking with reshape and ggplot (PDF, 1.1 meg) and Reisensburg, Germany. You can also see the example code I used in the presentation: R code.

Mailing list

You are welcome to ask reshape questions on R-help, but if you'd like to participate in a more focussed mailing list, please sign up for the manipulatr mailing list:

Your email address:

You must be a member to post messages, but anyone can read the archived discussions.


Require quicktime to view.

What's new in this version?

See the change log for changes in previous versions

What reshape doesn't do

Reshape is not a fully fledged OLAP solution. If you need to deal with very large datasets, or want to do complex aggregations or use functions that process data from multiple levels, you should probably use a full OLAP product.

Get involved

If you've discovered any bugs in the reshape package, or you have thought of a killer new feature, please email me: I'm also always on the look out for interesting data sets that reshape works well (or not so well) on.