Decast for counts


#1

I want to decast 3lkh rows to get count for each score as per for each category.
like
Category Score
A 0
B 9
C 8

i want

Category 0 1 2 3 4 5 6 7 8 9 10
A 600 700 800 700 900 789 890 778 765 890 998
B 60 70 400 700 900 789 890 778 765 890 99
C 600 700 800 700 900 789 890 778 765 890 998
D 630 720 840 750 960 789 890 78 76 80 99

But R studio is aborted the momemnt i run the code for dcast..
is there any method for partition the data while decasting.