sub2ind: sub2ind

sub2indR Documentation

sub2ind

Description

MATLAB style sub2ind function in R physical essence. Provides the one dim matrix index of row-column locations in matrix

(RIP matlab)

Usage

sub2ind(dim, r, c, byrow = F)

Arguments

dim

dimension of matrix to return index for

r

integer vector of row index to look up

c

length(r) integer vector of column index to look up

byrow

whether to calculate indices by row or column (= FALSE)

Value

length(r) vector of 1D indices into matrix with dim "dim"

Author(s)

Marcin Imielinski


mskilab/skitools documentation built on Aug. 31, 2023, 1:13 p.m.