I have the following data.frame in R.
(df1 <- data.frame(col1=rep(c('a','b','c'),each=3),
col2=rep(c('d','e','f'),3),
col3=1:9))
col1 col2 col3
1 a d 1
2 a e 2
3 a f 3
4 b d 4
5 b e 5
6 b f 6
7 c d 7
8 c e 8
9 c f 9
And I want to transform it into the following format.
d e f
a 1 2 3
b 4 5 6
c 7 8 9
What's the easiest way to do that?