[R] Loading matrices and other things

From: Mike Schuler <schulerm_at_bc.edu>
Date: Wed 01 Jun 2005 - 07:39:08 EST


Hi all,

I'm new to R, so needless to say I have a couple questions (which I hope I haven't missed through the documentation). I have several files in lower triangular matrix form. For each of these matrices, I want to perform some form of hierarchical clustering on each matrix and capture the output of the clustering.

The first problem I run into is actually loading the matrix file into R. I've attempted using the read.table function but to no avail. What is the best way to read in a matrix?

    Note: matrices are in a form like so, a space between each value, then a newline There is also a diagonal of 0's stripped out. (Matrices are the output of RNAdistance if that's helpful)

    Let's say its stored in a file called 'rtest'          
                21
                34 55
                55 34 21
                27 10 61 44
                59 42 25 8 40
                61 44 27 10 34 6
                73 64 57 48 66 44 50
                78 69 62 53 71 49 55 5
                77 68 103 94 70 94 96 88 89
                77 68 103 94 70 90 96 84 85 10
                31 24 53 46 30 50 52 72 73 74 74

Second, I've searched through the web and it seems hclust
<
http://www.maths.lth.se/help/R/.R/library/mva/html/hclust.html> is the
appropriate function From what I can tell from here
<http://stat.ethz.ch/R-manual/R-devel/library/stats/html/dist.html> the
above matrix should be a valid format (even without the 0s), but confirmation would be nice. And with hclust, does this produce a tree with the output, or would that be the plclust function? I haven't been able to experiment with this because of my inability to do accomplish the previous question.

And last, I want to be able to run R on many different files of the same matrix type. Is it possible to write a (Python) script run through the appropriate tasks and save the visual output as a postscript file?

Thanks in advance
- Mike Schuler

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 01 07:49:09 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:17 EST