Skip to contents

This function converts a double index for a matrix (xy) into a single index for values. This allows vectorised subsetting of incomplete rows and columns.

Usage

xyindex_to_nindex(x, y, nrow)

Arguments

x

vector of row numbers for target values.

y

vector of column numbers for target values.

nrow

The number of rows in the matrix

Value

A vector of indices for values in a matrix.