3
I have the following table:
Material Fornecedor
1 A
1 B
1 A
1 C
1 C
2 B
2 D
2 E
3 A
3 B
3 C
3 F
3 G
3 A
4 A
I need to create a new column of 1 and 0, where 0 will indicate that that supplier has already appeared in that material and 1 will indicate that the supplier appeared for the first time in that material. I mean, I’ll have the following table:
Material Fornecedor Qtde
1 A 1
1 B 1
1 A 0
1 C 1
1 C 0
2 B 1
2 D 1
2 E 1
3 A 1
3 B 1
3 C 1
3 F 1
3 G 1
3 A 0
4 A 1
How do I create the Qtde column? My data.frame has 560,000 rows.