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.l...@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)

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to