upper {datautils} | R Documentation |
Returns the (d*(d-1)/2) x 2 matrix of the (i,j) indexes to the upper triangle of a d x d matrix. The result can then directly be used as an index, see example.
upper(d)
d |
dimension of the square matrix which we intend to index. |
Index values
Pierrick Bruneau
inds <- upper(5) vals <- matrix(runif(25), nrow=5) selvals <- vals[inds] # vector containing the values of the upper triangle