0

I have a data set of latitude and longitudes and I want to group every three duplicate rows into one row to better show it on a map.

If my dataframe has these rows:

id    geom
 1    "-82.42   42.95"
 2    "-82.42   42.95"
 3    "-82.42   42.95"
 4    "-82.42   44.90"
 5    "-82.42   44.90"
 6    "-82.42   44.90"
 7    "-82.42   42.92"
 8    "-82.42   42.95"
 9    "-82.42   42.95"
 10    "-82.42   42.95"

After creating one row for every three duplicate rows, I'd generate a row (in a new data frame or mark this special row). If there weren't at least three duplicates, I'd disregard it.

id    geom
 3    "-82.42   42.95"
 6    "-82.42   44.90"
 10    "-82.42   42.95"

Thanks!

0 Answers0