[R] kmeans clustering

Andrej Kastrin andrej.kastrin at siol.net
Thu Jun 29 11:40:29 CEST 2006


richard mendes wrote:
> Hello R list members,
>
> I'm a bio informatics student from the Leiden university
> (netherlands). We were asked to make a program with different
> clustering methods. The problem we are experiencing is the following.
>
> we have a matrix with data like the following
>
>                  research1    research2    research3    enz
> sample1      0.5             0.2              0.4
>
> sample2      0.4             0.4              0.3
>
> sample3      0.7             0.2              0.8
>
> enz
>
>
> now if we use kmeans(matrix,3,20) the clustering method will cluster
> only on rows by using the columns values as multiple variables. The
> output from this syntax is for example
>
> sample1 = 1
> sample2 = 2
> sample3 = 3
> enz
>
> Is there a method that will use the rows and columns as seperate
> values so that every variable in the matrix will be assigned to a
> cluster instead of a row.
>
> the output then could be interperted as a heatmap.
>
> thank you in advance for your time,
>
> Richard Mendes
>
> ______________________________________________
> 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
>
>   
You mean something like:?
kmeans(dataMatrix,5) ## clustering by rows
kmeans(t(dataMatrix),5) ## clustering by attribute

HTH, Andrej



More information about the R-help mailing list