Lookup:
?diag
?upper.tri
?lower.tri
Example:
my.mat<-matrix(1:16,ncol=4)
my.mat
my.mat[upper.tri(my.mat)]<-3
my.mat
-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org]On Behalf Of kevinchang
Sent: 01 October 2007 17:37
To: r-help at r-project.org
Subject: [R] function for special matrix design
Hi All,
I am trying to make a matrix with a particular value for all the elements
above and including diagonal and another particular value for all the
elements below diagonal. Obviously , Matrix function in Matrix package does
not work since it only allow filling by either row or column. So I am
wondering if there is a built-in function allowing me to do this ? please
help. Thanks
--
View this message in context:
http://www.nabble.com/function-for-special-matrix-design-tf4549437.html#a12982709
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.