Hi,

I want to compute the lower triangle of a square matrix (optionally, sans
diagonal).  With for() loops I can do something like this:

## 5 by 5 matrix rtn
for (j in 1:5) {
        for (k in 1:j) {
                if (j != k) {  ## optional
                rtn[j, k] <- my.func(j, k)
                }
}
}


I'd like to do this with apply().  Is there some way I can do this kind of
'short-circuit'?

Thanks,


Mark Wilkinson
Informatics Analyst
St. Jude Children's Research Hospital
Department of Pharmaceutical Sciences

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to