i have one large data frame
ID code N
1 412 2
1 A341 1
1 A520 16
1 47 9
2 283 4
2 412 3
.......
the id is rep. and the i want assign the code is 412 598 A333 and the N heve>3 then i can Sort out table like this
ID code_412 code_598 code_A333
1 0 0 0
2 1 0 0
3 0 1 1
if the ID have code412 3 times or code598 3 times or codeA333 3 times then will key 1 else 0