[R-sig-Geo] cluster points within a given distance

marcelino.delacruz at upm.es marcelino.delacruz at upm.es
Tue Jul 31 21:38:28 CEST 2012


Let's say that your data.frame with the x and y coordnates is call
"cosaxy"

A possible option would be:

cosa.cc <- hclust(dist(cosaxy), "complete")
cosa.35<- cutree(cosa.cc, h=35)

cosa.35 is a vector that assign each point to a cluster that have a
distance between their points less or equal than 35.


HTH

Marcelino



Con fecha 31/7/2012, "Frederico Mestre" <mestre.frederico at gmail.com>
escribió:

>Hello:
>
>
>
>Having a data frame with x and y values for a set of points how can I
>cluster all the points that stand within a given distance.
>
>
>
>As an example: create clusters of points that have a distance between them
>less than 35.
>
>
>
>Thanks,
>
>
>
>Frederico
>
>
>
>
>	[[alternative HTML version deleted]]
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list