[R] Help in kmeans

Raji raji.sankaran at gmail.com
Sun Oct 16 16:08:20 CEST 2011


Hi All,

 For executing kmeans for Iris, we found that there were 2 different ways.

dataFrame <- read.csv("c:/Iris.csv",header=T)

1. kmeans_model<-kmeans(dataFrame[1:5],size=3)
   *This gave an error as it had Species which is a String column as one of
the inputs*

2.attach(dataFrame)
 
kmeans_model<-kmeans(cbind(SepalLength,SepalWidth,PetalLength,PetalWidth,Species),3)

* But this command worked and gave output.*

Does this mean that kmeans can accept String inputs also?

Can you please let me know how the second command works? 

Thanks in advance.

Regards,
Raji

--
View this message in context: http://r.789695.n4.nabble.com/Help-in-kmeans-tp3430433p3909552.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list