October 2015
Beginner to intermediate
246 pages
4h 55m
English
reshape2 is a package that consists mainly of two functions: melt and dcast/acast. Generally, it could be said that melt() transforms one row to multiple and shorter rows while dcast() and acast() do exactly the opposite.
The melt() function, basically, transforms one row of data to many by pivoting a set of variables (the measure variables) over a set of other variables (the id variables). The function is called as follows:
melt(dataset,id.vars,measure.vars,variable_name)
The id variables are usually factors or characters while the measure variables are the numeric ones. In fact, this is the behavior by default if none of the arguments are specified. variable_name is the name that adopts the column where the variables are specified (
Read now
Unlock full access