I have a data frame like this
----------------
RecID| A |B
----------------
1 |Dog | x
2 |Dog | y
3 |Dog | z
4 |Cat | a
5 |Cat | b
And want to know if there is anyway to transform it so that it is like this:
-----------------------------
RecID| A |B_1|B_2|B_3|
-----------------------------
1 |Dog| x | y | z |
2 |Cat| a | b | NA|
Basically create new columns of each possible value of B grouped by particular values of A and fill with NA if need be.