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?
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?
We can use
unstack
frombase R
Or if we use
spread
orpivot_wider
, make sure to create a sequence column数据