## reshape2 包

reshape2 用得比较多的是melt和cast两个函数。

melt函数对宽数据进行处理，得到长数据；
cast函数对长数据进行处理，得到宽数据；

melt(参数)

## cast函数

dcast借助于公式来描述数据的形状，左边参数表示”ID variables”，而右边的参数表示measured variables。可能需要几次尝试，才能找到合适的公式。

If it isn’t clear to you what just happened there, then have a look at this illustration:

help(package = "reshape2")

See the reshape2 website:
And read the paper on reshape:
Wickham, H. (2007). Reshaping data with the reshape package.
(But note that the paper is written for the reshape package not the
reshape2 package.)