Re: [R] Output of clustering packages

About this list Date view Thread view Subject view Author view Attachment view

From: Martin Maechler (maechler@stat.math.ethz.ch)
Date: Thu 13 Jun 2002 - 23:13:22 EST


Message-id: <15624.39538.363613.921892@gargle.gargle.HOWL>


>>>>> "AbMa" == Aboubakar Maitournam <amaitour@pasteur.fr> writes:

    AbMa> Dear all, I am sorry because my question is perhaps
    AbMa> trivial and is certainly a detail. It's related to
    AbMa> the output of some clustering package as mclust and
    AbMa> e1071. The output is as follows :

 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1
[149] 1 1

    AbMa> where [n] is the label of individual and 1, 2, 3 are
    AbMa> the index of classes.

    AbMa> How to get the output in the form
[1] 1
[2] 2
.
.
.
    AbMa> I have tried to use write.table without success.

The answer is cbind() : it makes a 1-column matrix from your vector
Try

 ii <- 1 + rpois(50, lam= 1)
 cbind(ii)

{and of course this has nothing to do with clustering ...}

    AbMa> Thank you in advance.

you're welcome

    AbMa> Aboubakar Maitournam.

Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:20 EST