Re: [R] Partition data into clusters

From: Suhaila Zainudin <>
Date: Mon, 24 Mar 2008 22:43:42 -0700


Just to inform you that I found the solution for the write.csv task I mentioned earlier. Searching thru the r-help leads me to this solution..

###Your soln starts
xx <- max(cl2$cl.kmr10.cluster)
# find out how many clusters there are.
my.clusters <- list(NULL) # set up an empty list for storage

# Loop through the dataset and subset by cluster.
for(i in 1:xx) {
 my.clusters[[i]] <- subset(cl2,
# Eh voilą!


### Your solution ends

# Soln for writing the clustered results into multiple files using loop.

for(i in 1:xx) {
  write.csv(my.clusters[[i]], paste("mycluster",i,sep=".")) }



        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 25 Mar 2008 - 05:49:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 25 Mar 2008 - 07:30:24 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive