Tutorial by Examples

The most flexible base R function for reshaping data is reshape. See ?reshape for its syntax. # create unbalanced longitudinal (panel) data set set.seed(1234) df <- data.frame(identifier=rep(1:5, each=3), location=rep(c("up", "down", "left", &quo...
Often data comes in tables. Generally one can divide this tabular data in wide and long formats. In a wide format, each variable has its own column. PersonHeight [cm]Age [yr]Alison17820Bob17445Carl18231 However, sometimes it is more convenient to have a long format, in which all variables are in o...

Page 1 of 1