powered by
diag.ind(x, n = 1, diag = TRUE)
diag
lower.tri
upper.tri
matrix
diag.ind( matrix(,ncol=5,nrow=5), n=3 )
Run the code above in your browser using DataLab