Matthew Ouellette
2012-Oct-31 23:08 UTC
[R] Clustering groups according to multiple variables
Dear R help, I am trying to cluster my data according to "group" in a data frame such as the following: df=data.frame(group=rep(c("a","b","c","d"),10),(replicate(100,rnorm(40)))) I'm not sure how to tell hclust() that I want to cluster according to the group variable. For example: dfclust=hclust(dist(df),"ave") plot(dfclust) Clusters according to each individual row. What I'm looking for is an unrooted tree that will show similarity/dissimilarity among groups according to the data set as a whole. I appreciate the help, MO [[alternative HTML version deleted]]
Matthew Ouellette
2012-Oct-31 23:09 UTC
[R] Clustering groups according to multiple variables
Dear R help, I am trying to cluster my data according to "group" in a data frame such as the following: df=data.frame(group=rep(c("a","b","c","d"),10),(replicate(100,rnorm(40)))) I'm not sure how to tell hclust() that I want to cluster according to the group variable. For example: dfclust=hclust(dist(df),"ave") plot(dfclust) Clusters according to each individual row. What I'm looking for is an unrooted tree that will show similarity/dissimilarity among groups according to the data set as a whole. I appreciate the help, MO [[alternative HTML version deleted]]