分组或汇总和计数

I have raw data as below which enumerators entered same value multiple times I want to summarize it as desired output please refer to attach If you could possibly tell me the code R I will be much appreciate Thank you in advanceRaw data and desired output