[R] Save Cluster results to data frame

Christian Hennig chrish at stats.ucl.ac.uk
Mon May 18 14:05:03 CEST 2009

Hi Chris,

this isn't particularly a clustering question, is it?

Why don't you just take your clustering vector 
(pam.output.object$clustering) and assign it to 
a$clustering (given that a is the name of your data frame)?

And why don't you just define a new character/string vector and assign
the cluster names that you want to it using if or case?


On Mon, 18 May 2009, Chris Arthur wrote:

> If I cluster my data into 3 sets, using pam for instance, is there a way 
> to save the resultant cluster results, to the originating data frame. and 
> related to that how do i say change the cluster names to something a bit 
> more meaningful that 1..2...3
> So it goes like this.
> Data  ---> Cluster into 3 groups ----> given them meaningful names
>                                                                --->output 
> back to data frame
> Thanks for the help
> Chris
> ______________________________________________
> 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.

*** --- ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
chrish at stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche

More information about the R-help mailing list