Skip to content
Prev 334417 / 398506 Next

to replace the for loop

On 14-12-2013, at 08:01, Arnaud Michel <michel.arnaud at cirad.fr> wrote:

            
Your code is mangled.
We don?t know what T is.
You refer to TEMP in the for loop but you most likely meant T.

Shouldn?t the second nrow in your for loop be ncol?
Search with ??uppertri and you?ll find lower.tri in base with sufficient description to have a look at that entry.
Depending on what packages you have, you may find more.
T[col(T)>=row(T)] <- 0
T[upper.tri(T,diag=TRUE) ] <- 0

Berend