Hi,

Thanks for your reply. I have tried yr suggestions with success. TQVM.

I have another query, say I want to write each cluster into a csv file such
as follows:

clus1 <- my.clusters[[1]]
write.csv(clus1, file = "clus1.csv")
....
.....
.....
clus10 <- my.clusters[[10]]
write.csv(clus10,file = "clus10.csv")

I can write the functions to do that for all 10 clusters by repeatedly
calling write.csv as  above. Is there a more elegant way of doing it by
using a loop (for example).

for(i in 1:xx) {
clusn <- my.clusters[[n]]
write.csv(clusn, file = "clusn.csv")
}

I am trying something using list as well, as folows:

names( my.clusters ) <- paste('Cluster_',1:10, sep='')

Now I can  use

my.clusters$Cluster_1

The above will return all members of Cluster_1.

I have an idea to use lapply or sapply to do write.csv on each
components(Cluster_1.....Cluster_n)  from my.clusters, that will do the same
as the loop example. Maybe this is the better way..


Any comments are appreciated.

Thanks!

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to