Skip to content
Back to formatted view

Raw Message

Message-ID: <1318774100298-3909552.post@n4.nabble.com>
Date: 2011-10-16T14:08:20Z
From: Raji
Subject: Help in kmeans
In-Reply-To: <1302085178483-3430433.post@n4.nabble.com>

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.