upper: upper

Description Usage Arguments Value Author(s) Examples

View source: R/functions.R

Description

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.

Usage

1
upper(d)

Arguments

d

dimension of the square matrix which we intend to index.

Value

Index values

Author(s)

Pierrick Bruneau

Examples

1
2
3
inds <- upper(5)
vals <- matrix(runif(25), nrow=5)
selvals <- vals[inds] # vector containing the values of the upper triangle

datautils documentation built on May 2, 2019, 8:56 a.m.

Related to upper in datautils...