Using the code from : http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering/Hierarchical_Clustering
Here is how to generate a dendogram :
# import data
x <- read.table("data.txt")
# run AGNES
ag <- agnes (x, false, metric="euclidean", false, method ="single")
# print components of ag
print(ag)
# plot clusters
plot(ag, ask = FALSE, which.plots = NULL)
I'm receiving an error on
ag <- agnes (x, false, metric="euclidean", false, method ="single")
The error is :
Error in agnes(x, false, metric = "euclidean", false, method = "single") :
object 'false' not found
This implementation of agnes works but its generating numbered labels for the dendogram :
ag <- agnes (data, metric="euclidean")
# plot clusters
plot(ag, ask = FALSE, which.plots = NULL)
The dendogram :
The dendogram generated from http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering/Hierarchical_Clustering
includes labels :
Here is the data file :
,ba,fi,mi,vo,rm,to
ba,0,662,877,255,412,996
fi,662,0,295,468,268,400
mi,877,295,0,754,564,138
vo,255,468,754,0,219,869
rm,412,268,564,219,0,669
to,996,400,138,869,669,0
How can generate a labelled hierarchical cluster based on above data which is same as labelled dendogram above ?
Update :
After following @sgibb suggestion I used this :
ag <- agnes(data, FALSE, metric="euclidean", FALSE, method ="single")
# plot clusters
plot(ag, ask = FALSE, which.plots = NULL)
The dendogram being generated is now :
This is an incorrect structure. Maybe its beacuse the column names of my dataset are appearing as 1,2,3,4,5,6 and are not labelled, if so how can I modify the import statement ?
the dataset imported :