Learn R Programming

oeli (version 0.5.0)

matrix_indices: Get matrix indices

Description

This function returns matrix indices as character.

Usage

matrix_indices(x, prefix = "", exclude_diagonal = FALSE)

Value

A character

vector.

Arguments

x

A matrix.

prefix

A character as prefix for the indices.

exclude_diagonal

Either TRUE to exclude indices where row equals column, or FALSE to include those.

Examples

Run this code
M <- diag(3)
matrix_indices(M)
matrix_indices(M, "M_")
matrix_indices(M, "M_", TRUE)

Run the code above in your browser using DataLab