批量将行转置为R中的列

My data.frame df looks like this:

A 1  
A 2  
A 5  
B 2  
B 3  
B 4  
C 3  
C 7  
C 9  

我希望它看起来像这样:

A B C  
1 2 3  
2 3 7  
5 4 9  

I have tried spread() but probably not in the right way. Any ideas?