You need to use hhid as the rownames for housing.cluster rather than
including it as a variable in the data.frame:
housing.cluster <-data.frame(htypec1, afforcr1, resyrc1, crowdcc1, chprbos1)
rownames(housing.cluster) <- hhid
Then it will not be included in the cluster analysis but will be used to
label the dendrogram.
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of adlynch
Sent: Thursday, June 16, 2011 12:35 PM
To: r-help at r-project.org
Subject: [R] Specify ID variable in daisy{cluster}
Hi All - I am using the daisy function from the cluster library to create a
dissimilarity matrix. I'm going to use that matrix to run a cluster
analysis. My participants are identified with the variable, hhid. However,
when I try to keep hhid in the dataset that I use to create the
dissimilarity matrix, daisy uses it to create the matrix rather than
ignoring it as an ID variable. I need to have the ID variable so I can
later on identify which cluster each participant was classified as. Any
thoughts would be much appreciated!
housing.cluster <-data.frame(hhid, htypec1, afforcr1, resyrc1, crowdcc1,
chprbos1)
housingdiss <- daisy(housing.cluster, metric="gower")
--
View this message in context:
http://r.789695.n4.nabble.com/Specify-ID-variable-in-daisy-cluster-tp3603136
p3603136.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.