The given data is like this:
df<-data.frame(farmer=c("F1","F1","F1","F2","F2","F2","F3","F4","F4"),
c2=c(4,4,5,3,3,3,1,2,1))
df
Question is: I would like to get the sum of farmer whose values in the c2 column are the same.
The output of this problem is 2. But how to use code to realize it? Which function should be used?