[R] 2D fellows

TRAN Liem FTM/Men
Tue, 16 May 2000 10:08:20 -0000

Hello Winfried

> I don''t know what you mean exactly by a "2D-array", I
would think first of
> something you could easily convert to a matrix, or a data frame! (I just
had a
> look on "Notes on R" and the description of arrays there confirms
my belief
> about the convertion.)

Indeed, my objects can be considered as matrix or data frame


> Well, if you could convert your arrays into vectors (via matrix or data
frame
>  if you want to) and collect them in a data frame you could use these
functions.

It would give me (for example with "dist") the (relative) distances
between
my collection of rows.

My problem (I realize I wasn''t precise enough) is to calulate, for
example, the distance between two matrices and not between two rows.

If I consider 2 matrices A and B with N rows each (and M columns), I
could use dist on each pair of rows (one for A, one for B), and compute
N time "dist" on 2 x M matrices.

And I could after calculate a distance with the N distances but I find
it a bit heavy, and I don''t know how to
perform an object which would be usable as input for, let''s say,
"hclust".

> If you need a special distance you could program a function in which you
compute
> the pairwise distances and write them to a dissimilarity matrix as in the
> package cluster.

That is typically my problem with R: How can I write the right object
like a dissimilarity matrix if I need one?
I''m not used enough with the "statistical" objects and not
used enough
with R to succeed writing directly the objects in the right "R-shape".
That''s why I would like to find already "R-shaped" objects.

> For a description see the documentation there (or just type
> daisy after loading the package cluster). With this you could use the
functions
> diana for divisive hierarchical
> clustering, agnes for agglomerative nesting or for k-means pam.
>

I just installed the cluster package among others. I hope to find what
I''m looking for.
Otherwise, I''ll be back ;-)

> I hope this helps,
>

It does. Many thanks

Li?m