[R] beginners k means clustering question

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Apr 27 22:44:33 CEST 2004


Johri, Saurabh wrote:

> Hi all,
>  
> I am wandering.. is it possible to cluster data which is in a single
> column ?
> for example.. I have some data as follows:
>  
> 4013
> 7362
> 7585
> 9304
> 11879
> 14785
> 21795
> 30500
> 30669
> 30924
> 33988
> 36975
> 40422
> 42911
> 50501
> 51593
> 53729
> 54338
> 55497
> 57337
> 61993
> 62601
> 66229
> 69815
> 69933
> 70760
> 71340
> 75921
> 83972
> 90134
> 91061
> .
> .
> .
>  
> is it possible to cluster this data since it is in a single column ?
>  
> I have used the following R commands:
>  
> data <- read.table("cluster.txt")
> dataMatrix <- t(data)
>  
> I then tried to cluster using the following:
>  
> xcl <-cclust(dataMatrix,2,20,verbose=TRUE,method="kmeans")
>  
> when I run this i receive the following error message:
>  
> Error in x[rank(runif(xrows))[1:ncenters], ] : 
>         incorrect number of dimensions
> 
> I would be grateful for any pointers in the right direction
>  
> Thanks for your help
>  
> Saurabh
>  
>  
>  


cclust() does not work for one-dim. data. I'd use kmeans() in package 
"stats" ...

Uwe Ligges



> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list