positionToIndex: positionToIndex

Description Usage Arguments Details Value Author(s) Examples

View source: R/indices.r

Description

Given row and column positions calculate the index.

Usage

1

Arguments

row

Vector specifying row positions

col

Vector specifying column positions

nrow

The number of rows in the matrix

Details

With row and column positions this computes the index, starting at (1,1) working down rows then across columns.

Value

A vector of indices

Author(s)

Jared P. Lander

Examples

1
2
3
4
positionToIndex(1, 2, 2)
positionToIndex(row=c(1, 1, 2, 1, 3), col=c(1, 2, 2, 3, 3), nrow=3)
positionToIndex(rep(1:4, 4), rep(1:4, each=4), nrow=4)
positionToIndex(rep(c(1, 3, 5), 3), rep(1:3, each=3), nrow=5)

useful documentation built on June 7, 2017, 9:02 a.m.

Search within the useful package
Search all R packages, documentation and source code