[R] Partition data into clusters

John Kane jrkrideau at yahoo.ca
Wed Mar 19 14:54:04 CET 2008


Can you supply a small self-contained example of this?
--- Suhaila Zainudin <suhaila.zainudin at gmail.com>
wrote:

> Greetings R-users,
> 
> I have been using the fpc package in R to cluster my
> data. Speficically I am
> using kmeansruns clustering.
> I would like to know how I use R to partition data
> into clusters. What I am
> doing is as follows.
> 
> # Use csv file as input
> #####################
> wholeset = read.csv("Spellman800genesImputed.csv")
> 
> # exclude first col (gene names)
> ##########################
> wholeset2 = wholeset[,-1]
> 
> #Use fpc
> ###########################
> library(fpc)
> 
> cl.kmr10 <- kmeansruns(wholeset2,k=10,runs=10)
> 
> 
> #append cluster label to original dataset
> ###################
> cl2 <- data.frame(wholeset, cl.kmr10$cluster)
> 
> After this step, I write cl2 into a csv file and
> manually partition data
> into its respective clusters using Excel.
> Then I read the data from each clusters back into R
> for further analysis.
> 
> Can I do the data partitioning directly in R?
> 
> TQ
> 
> 
> -- 
> Suhaila Zainudin
> PhD Candidate
> Universiti Teknologi Malaysia
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.
>



More information about the R-help mailing list