Codes Cluster

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

mydata <- read.csv(file.

choose(),header=TRUE)

head(mydadata)

str(mydata)

pairs(mydata)

# Scatter plot
plot(mydata$Tollfree~ mydata$reputation, data = mydata)
with(mydata,text(mydata$Tollfree~ mydata$reputation, labels=mydata$Company,pos=4))

#Compute dissimilarity matrix


d <- dist(mydata, method = "euclidean")

# Hierarchical clustering using Ward's method


res.hc <- hclust(d, method = "ward.D2" )

# Visualize
plot(res.hc, cex = 0.6)

rect.hclust(res.hc, k = 3, border = 2:5)

kc<-kmeans(nor,3)

You might also like