I have the following data
subject_id;sign;long;lat;kind;area\n
361869449;;7.66839336;45.03530199;U;Torino\n
361890869;;7.63652742;45.0744409;S;Torino\n 361890954;;7.64516603;45.05570822;S;Torino\n
361870497;;9.18559126;45.45859693;S;Milano\n 361870607;;12.49623211;41.9212079;S;Roma 361872151;;9.46181677;45.54500293;U;Milano 361875393;;12.42673437;41.87965563;S;Roma
How can I group by area and by city in order to have the results like this for example :
area, kind, counter
Torino, U, 1
Torino, S, 2
Roma, S, 2
Milano, S, 1
....
I put your data in a textfile and loaded it into a data.frame df. Then the following will work.