R: Invert linear indices from a matrix

idxInvert {PCIT} | R Documentation

## 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

### Author(s)

Nathan S. Watson-Haigh

### Examples

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

[Package PCIT version 1.5-3 Index]