Description Usage Arguments Details Value Author(s) Examples

View source: R/GraphAlignment.R

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

1 | ```
GetBinNumber(x, lookup, clamp=TRUE)
``` |

`x` |
value to be binned |

`lookup` |
lookup vector |

`clamp` |
clamp value to lookup range |

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.

This function returns the bin number corresponding to the input value. The bin number is obtained by performing a lookup in the specified lookup vector.

Joern P. Meier, Michal Kolar, Ville Mustonen, Michael Laessig, and Johannes Berg

1 2 3 | ```
lookup <- c(-1, 0, 1)
GetBinNumber(-0.5, lookup)
GetBinNumber(0.5, lookup)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.