[R] cluster analysis

Martin Maechler maechler at stat.math.ethz.ch
Fri Oct 15 14:51:30 CEST 2004

>>>>> "James" == James Foadi <foadi at ysbl.york.ac.uk>
>>>>>     on Fri, 15 Oct 2004 11:36:14 +0100 writes:

    James> On Friday 15 Oct 2004 11:02 am, you wrote:
    >> or unname(classi) -- which is slightly more expressive in this
    >> case and possibly more desirable in other situations.
    >> Martin Maechler, ETH Zurich

    James> Thanks, Martin.
    James> I've tried, like you suggested:

    James> un_classi <- unname(classi)

    James> but nothing changed. By typing, for instance:

    James> un_classi[[1]]

"of course" -- I just chimed in with Christian who proposed as.vector(.)
Since your 'classi' is a list with named vector as components,
you'd need something like

  un_classi <- lapply(classi, unname)

I'm sorry to have added more confusion.
OTOH, really, I think you should learn a bit more about basic
manipulation of R objects and study something like
"An Introduction to R".

Regards, Martin

    James> I still obtained twice the values. But, if I type:

    James> un_classe_01 <- unname(classi[[1]])

    James> the un_classe_01 is an unnamed vector.

(exactly, since it works on the *component* of a list)

    James> Cheers,

    James> james

More information about the R-help mailing list