I have a data frame as follows:
DF<-data.frame(a=c(1,1,1,2,2,2,3,3,4,4),b=c(43,23,45,65,43,23,65,76,87,4))
a b
1 43
1 23
1 45
2 65
2 43
2 23
3 65
3 76
4 87
4 4
I want to set a flag like this:
a b flag
1 43 A
1 23 B
1 45 C
2 65 A
2 43 B
2 23 C
3 65 A
3 76 B
4 87 A
4 4 B
How can I get this done in R?