GetBinNumber {GraphAlignment} | R Documentation |

## Get bin number

### Description

Get the bin number for the argument using the specified lookup vector.

### Usage

GetBinNumber(x, lookup, clamp=TRUE)

### Arguments

`x` |
value to be binned |

`lookup` |
lookup vector |

`clamp` |
clamp value to lookup range |

### Details

The lookup vector defines the lower and upper boundaries for each bin. The first entry in the lookup vector is the lower boundary of the first bin, while the last value in the lookup vector is the upper boundary of the last bin. For all other entries, entry i of the lookup vector defines the upper boundary of the (i-1)-th bin and the lower boundary of the i-th bin. The number of bins is therefore n-1, where n is the length of the lookup vector. A lookup vector must have at least two elements.

If clamping is enabled (clamp=TRUE), arguments which fall below the lower boundary of the first bin are treated as if they are actually in the first bin. Likewise, values which are above the upper boundary of the last bin are treated as if they are actually in the last bin. If clamping is disabled (clamp=FALSE), values outside the lookup range cause an error.

### Value

The return value is the bin number corresponding to the argument.

### Examples

lookup <- c(-1, 0, 1)
GetBinNumber(-0.5, lookup)
GetBinNumber(0.5, lookup)

[Package

*GraphAlignment* version 1.0-0

Index]