This seems a single linkage clustering issue:

 > grouping <- hclust(dist(data.frame(x,y)),"single")
 > cutree(grouping, h=0.5)
[1] 1 1 1 2 3 3 3

Cheers,

Marcelino



At 13:04 26/10/2010, jgarcia@ija.csic.es wrote:
>Dear all,
>I am wondering if there is a direct function (I cannot find any) in R, to
>obtain, a "factor" vector to identify which points could be grouped in a
>set, using a specific threshold distance as clustering criterion.
>
>#e.g, with 7 points with coordinates:
>
>x <- c(1.01,0.95,1.05,1.03,3.03,2.99,3.04)
>y <- c(3.01,3.02,3.04,5.23,2.01,2.02,1.98)
>
># and, let's say, distance threshold 0.5, the answer would be:
>(1,1,1,2,3,3,3)
>
># where the threshold is the maximum distance between any two points for
>each cluster
>
>A better approach would be that threshold could be specified as the
>distance between any point in each cluster, and its corresponding center
>of mass for that cluster, but I guess this would require some loops. Isn't
>it? S, I would be happy enough with the abovementioned approach.
>
>If there isn't a direct function, don't worry. I'll try to find a solution
>computing distances...
>
>Thanks,
>Javier
>---
>
>
>
>
> > is it possible to load a complete Grass mapset into a raster stack or
> > brick
> > with a single command?
> >
> > --
> > View this message in context:
> > 
> http://r-sig-geo.2731867.n2.nabble.com/Grass-and-raster-package-tp5667199p5667199.html
> > Sent from the R-sig-geo mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo@stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo@stat.math.ethz.ch
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo

____________________________________

Marcelino de la Cruz Rot
Depto. Biologia Vegetal
EUIT Agricola
Universidad Politecnica de Madrid

tel: 34 + 913365435
____________________________________  
	[[alternative HTML version deleted]]

