>id = c(1,2,3,4)
>desc = c("A", "B", "B", "A")
>df = data.frame(id, desc)
>df
id descr
1 A
2 B
3 B
4 A
how can I reshape the df to look like
A B
1 2
4 3
We can use unstack
(assuming that there are equal number of elements in 'id' for 'desc')
unstack(df, id~desc)
# A B
#1 1 2
#2 4 3