Learn R Programming

crochet (version 2.3.0)

ijtok: Convert Two-Dimensional Indices i and j to One-Dimensional Index k

Description

ijtok is a helper function that converts two-dimensional indices i and j to a one-dimensional index k. This can be useful if, for example, one-dimensional indexing is easier to implement than two-dimensional indexing.

Usage

ijtok(x, i, j)

Arguments

x

A matrix-like object.

i

The first component of a two-dimensional index.

j

The second component of a two-dimensional index.

Value

A one-dimensional index.

Details

It is assumed that all indices are one-based.