On Tue, 2005-11-22 at 21:55 +0100, Serguei Kaniovski wrote:
> mdim=4
> m<-matrix(round(runif(mdim^mdim)),mdim,mdim)
One approach:
> m
[,1] [,2] [,3] [,4]
[1,] 0 0 1 0
[2,] 0 1 1 0
[3,] 0 0 1 1
[4,] 0 0 0 0
> idx <- apply(m, 1, sum)
> m[idx,]
[,1] [,2] [,3] [,4]
[1,] 0 0 1 0
[2,] 0 1 1 0
[3,] 0 1 1 0
>
-------------------------------------------------------------------
Rajarshi Guha <[EMAIL PROTECTED]> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
Cogito cogito ergo cogito sum
(I think that I think, therefore I think that I am.)
-- Ambrose Bierce
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html