I know this has been asked numerous times on here under the rubric of \"long to wide\" but I\'ve run into a situation where I have two value variables that are repeated meas
I think this will do it:
library(reshape)
m <- melt(DF)
Simplest, but time and score are in the opposite order from your example (in case it matters)
cast(m,id+sex~...)
Or more explicitly:
cast(m,id+sex~variable+time)
You can cut this down to a one-liner:
recast(DF,id+sex~...)
If you like you can use the newer reshape2 package instead of reshape, replacing cast with dcast (the version of recast included in reshape2 doesn't give the desired result.)