Hi Laura,
you could use:
mat <- matrix(NA, 10, 10)
mat[col(mat)>row(mat)] <- 1:15
####
mat[col(mat)<row(mat)] <- 0 # optional: use it if the lower part is
not zero
mat
mat+t(mat)
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/396887
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Laura Holt" <lauraholt_983@hotmail.com>
To: <s-news@lists.biostat.wustl.edu>
Sent: Monday, October 18, 2004 9:13 AM
Subject: [S] constructing a symmetric matrix
Dear S + People:
I am constructing a symmetric matrix. I have the upper part
calculated.
Is there a quick way to "copy" the upper part over to the lower
part, please?
(other than for loop)
S + v6.2 Windows.
Thanks,
Sincerely,
Laura Holt
mailto: lauraholt_983@hotmail.com
_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from
McAfee® Security.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu
with
the BODY of the message: unsubscribe s-news
|