Learn R Programming

PCIT (version 1.5-3)

idxInvert: Invert linear indices from a matrix

Description

Given a matrix from which which a subset of linear indices were obtained, invert those indices.

Usage

idxInvert(m, idx)

Arguments

m
- A matrix from which idx is a subset of linear indices, OR the number of rows/columns from such a matirx
idx
- A vector containing a subset of linear indices from the matrix m

Examples

Run this code
	m <- matrix(1, 5, 5)
	diag(m) <- 0
	m
	idx <- which(m==0)
	idx
	idxInvert(m, idx)
	idxInvert(5, idx)

Run the code above in your browser using DataLab