Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- W X Y week Z
- w1 x1 y1 1 0
- w1 x1 y1 2 0.1
- w1 x1 y1 3 0.2
- w2 x2 y1 1 0.5
- w2 x2 y1 2 0.7
- w2 x2 y1 3 0.3
- w3 x1 y1 1 0.1
- w3 x1 y1 2 0.2
- w3 x1 y1 3 0.5
- w4 x2 y2 1 0.7
- w4 x2 y2 2 0.3
- w4 x2 y2 3 0.1
- w5 x1 y2 1 0.3
- w5 x1 y2 2 0.1
- w5 x1 y2 3 0.2
- cast(foo, W + X + Y ~ ., max, value="Z")
- W X Y week Z
- w1 x1 y1 3 0.2
- w2 x2 y1 2 0.7
- w3 x1 y1 3 0.5
- w4 x2 y2 1 0.7
- w5 x1 y2 1 0.3
- library("plyr")
- ddply(foo, .(W, X, Y), summarise, week=week[which.max(Z)], Z=max(Z))
Add Comment
Please, Sign In to add comment