Learn R Programming

GraphAlignment (version 1.36.0)

MatrixToBin: Convert matrix to bin representation

Description

Convert a matrix of real numbers to a vector of integer bin numbers according to the specified lookup vector.

Usage

MatrixToBin(M, lookup, clamp=TRUE)

Arguments

M
input matrix
lookup
lookup vector
clamp
clamp values to lookup range

Value

The return value is a matrix containing the bin numbers for the elements of the input matrix.

Details

This function transforms a matrix of arbitrary values into a matrix of bin numbers corresponding to the data in the input matrix. Bin numbers are found using the specified lookup table (see GetBinNumber).

Examples

Run this code
  m <- matrix(rnorm(25), 5, 5)
  lookup <- 0.2*(-5:5)
  MatrixToBin(m, lookup)

Run the code above in your browser using DataLab