Re: [R] kmeans: number of cluster centres must lie between 1 and nrow(x)

2011-02-02 Thread Feng Li
Thank you for the suggestion and it is exactly as you said only one observation in each cluster. I know I can avoid this anyway and I am just out of curiosity of the error. I am writing a special algorithm to cluster some datasets with different numbers of observations. For some particular dataset

[R] kmeans: number of cluster centres must lie between 1 and nrow(x)

2011-02-01 Thread Feng Li
Dear R, Can't I cluster a dataset into k clusters where k is exactly the number of observations? I have version 12.2 installed. See this example > a <- matrix(1:100, 20) > kmeans(a, 20) Error: number of cluster centres must lie between 1 and nrow(x) This is a bit ad-hoc but I known R from versio