Le 17/06/10 06:44, ZZY ZYBOYS a écrit :
Dear all: I have a question regarding on how to take the lower triangular part from a full matrix. for example 1 2 3 1 0 0 3 4 5 to 3 4 0 7 8 9 7 8 9 Thanks, Joey
Please take at least the time to send a reproducible example on how you make you data, i.e:
> x <- matrix( 1:9, nr = 3, byrow = T ) See ?lower.tri > x[ upper.tri(x) ] <- 0 Or see ?row and ?col > x[ row(x) < col(x) ] <- 0 Also note that ??triangular finds lower.tri Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://bit.ly/98Uf7u : Rcpp 0.8.1 |- http://bit.ly/c6YnCi : graph gallery collage `- http://bit.ly/bZ7ltC : inline 0.3.5 ______________________________________________ R-help@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.