[R] matrix export

Sean Davis sdavis2 at mail.nih.gov
Thu Jan 19 20:09:47 CET 2006




On 1/19/06 2:05 PM, "Eric Pante" <ericpante at hotmail.com> wrote:

> Thanks, Bert
> 
> write.table won't do the trick, because distance matrices in R are
> presented as lower triangular matrices. write.table "cannot coerce
> class "dist" into a data.frame".
> 
> maybe there is a way to transform the lower triangular matrix into a
> full matrix, and then use write.table ?

Did you try as.matrix()?

>From the dist() help page:

     'as.dist()' is a generic function.  Its default method handles
     objects inheriting from class '"dist"', or coercible to matrices
     using 'as.matrix()'.


Sean




More information about the R-help mailing list