Re: [R] Silhouette function problem

2010-12-31 Thread ADias
Hello, thank you all. I have been able to solve my problem with your help. The problem I am trying to solve is: I am working on a clustering method to group a data base. At the moment I am using the clustering hierarchical method and trying to get to the best K group value via the silhouette fu

Re: [R] Silhouette function problem

2010-12-31 Thread jim holtman
Is this what you want: > library(cluster) > d<-hclust(dist(iris[,-5])) > > avgs<-sapply(1:20,function(x) + summary(silhouette(cutree(d,x), + + dist(iris[,-5] > # str(avgs) > > # print out the average widths > for (i in 2:length(avgs)){ # ignore first item + cat('i=', i, 'average=', avgs[[

Re: [R] Silhouette function problem

2010-12-31 Thread David Winsemius
On Dec 31, 2010, at 10:34 AM, ADias wrote: ADias wrote: Hi, I am using the code below to get a plot that will show me on the X axis the number of clusters and on the Y axis the cluster average widths. However I am getting this error: Error in summary(silhouette(cutree(d, x), dist(iris[

Re: [R] Silhouette function problem

2010-12-31 Thread ADias
ADias wrote: > > Hi, > > I am using the code below to get a plot that will show me on the X axis > the number of clusters and on the Y axis the cluster average widths. > However I am getting this error: > > Error in summary(silhouette(cutree(d, x), dist(iris[, -5])))$si.summary : > $ operat

[R] Silhouette function problem

2010-12-30 Thread ADias
Hi, I am using code below to get a plot that will show me on the X axis the number of clusters and on the Y axis the cluster average widths. However I am getting this error: Error in summary(silhouette(cutree(d, x), dist(iris[, -5])))$si.summary : $ operator is invalid for atomic vectors the