s-news
[Top] [All Lists]

Re: How to write out lower triangle matrix to file?

To: att3380@garnet.acns.fsu.edu
Subject: Re: How to write out lower triangle matrix to file?
From: longhow.lam@nl.abnamro.com
Date: Tue, 24 Jul 2001 09:56:42 +0200
Cc: s-news@lists.biostat.wustl.edu
One way to do it is to transform the matrix to a character matrix, replace
the upper (or lower) triangle with spaces or tabs and write out using
write.table. So that would look like:

x <- matrix(rnorm(100),ncol=10)
x <- matrix(as.character(x),ncol=10)
x[lower.tri(x)] <- "          "
write.table(x,file="tmp.txt", sep="")

You may need to get rid of some digits when you really want to make it look
nice.

Hope this helps,
Longhow

>Dear Friends,
>
>How can we write a triangle matrix to a file with a triangle matrix format?
>I tried bot write table and cat both did not help, Format changes.Thank you,
>
>Ahmet,






---------------------------------------------------------------------------
This  message  (including  any  attachments)  is  confidential  and  may be
privileged.  If you have received it by mistake please notify the sender by
return  e-mail  and  delete this message from your system. Any unauthorised
use  or  dissemination  of  this  message  in  whole or in part is strictly
prohibited.  Please  note  that e-mails are susceptible to change. ABN AMRO
Bank  N.V.  (including  its  group  companies) shall not be responsible nor
liable  for  the  proper  and  complete  transmission  of  the  information
contained  in this communication nor for any delay in its receipt or damage
to  your  system.  ABN  AMRO  Bank  N.V.  (or its group companies) does not
guarantee  that the integrity of this communication has been maintained nor
that this communication is free of viruses, interceptions or interference.
---------------------------------------------------------------------------


<Prev in Thread] Current Thread [Next in Thread>
  • Re: How to write out lower triangle matrix to file?, longhow . lam <=