[R] kmeans

Ranjan Maitra maitra at iastate.edu
Tue Mar 20 19:16:28 CET 2007


Please read "An Introduction to R" which is available if your type 

> help.start() 

at the R-prompt.

HTH.
Ranjan

On Tue, 20 Mar 2007 19:10:17 +0100 "Sergio Della Franca" <sergio.della.franca at gmail.com> wrote:

> Dear R-helpers,
> 
> I have this dataset(y):
> 
>   YEAR   PRODUCTS
>   1             10
>   2             42
>   3             25
>   4             42
>   5             40
>   6             45
>   7             44
>   8             47
>   9             42
> 
> I perform kmeans clustering, and the results are the following:
> 
> 
> Cluster means:
>       YEAR  PRODUCTS
> 1 3.666667 41.33333
> 2 7.500000 44.50000
> 3 2.000000 17.50000
> 
> Clustering vector:
> 1 2 3 4 5 6 7 8 9
> 3 1 3 1 1 2 2 2 2
> Now my problem is add acolumn at my dataset(y) whit the information of
> clustering vector, i.e.:
> 
>    YEAR   PRODUCTS *clustering vector*
>   1             10                    *3*
>   2             42                    *1*
>   3             25                    *3*
>   4             42                    *1*
>   5             40                    *1*
>   6             45                    *2*
>   7             44                    *2*
>   8             47                    *2*
>   9             42                    *2*
> 
> 
> How can I obtain my new dataset with the information of clustering
> vector?
> 
> 
> Thank you in advance.
> 
> Sergio Della Franca.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list