indexMatrix: Convenience function for selecting multiple elements from a...

View source: R/misc.R

indexMatrixR Documentation

Convenience function for selecting multiple elements from a matrix by rows and columns position

Description

Convenience function for selecting multiple elements from a matrix by rows and columns position

Usage

indexMatrix(rows, cols, mat, returnIndex = FALSE)

Arguments

rows

row coordinate of matrix

cols

col coorinate of matrix

mat

Matrix of interest

returnIndex

If TRUE return the one dimensional index for the items otherwise return the selected elements of the matrix

Value

A vector of indices if returnIndex is TRUE or a vector of the selected matrix elements

Examples

indexMatrix(c(1,2,3),c(1,2,1),matrix(1:9,nrow=3,byrow=TRUE))

sherrillmix/dnar documentation built on July 18, 2022, 10:07 p.m.