Look at clustering task view
http://cran.r-project.org/web/views/Cluster.html
A simple way to do it is
library(cluster)
dat$cluster <- pam(dat, 3, stand=T)$clustering
plot(dat$lon, dat$lat, col=dat$cluster)
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.list at gmail.com
On Oct 20, 2010, at 6:41 PM, jonas garcia wrote:
> dat<- data.frame( lon = c(rnorm(1000, mean=-10), rnorm(1000, mean=10),
> rnorm(1000, mean=5)),
> lat = c(rnorm(1000, mean=40), rnorm(1000, mean=30), rnorm(1000,
> mean=0)))
>
> plot(dat$lon, dat$lat)