Learn R Programming

AssocBin (version 1.1-0)

rUnifSplit: Random uniform splitting

Description

Split bins randomly and uniformly

Usage

rUnifSplit(bin, minExp = 0, squarify = FALSE)

Value

A list of two bins resulting from the split of `bin` at a random location on a random margin

Arguments

bin

a bin to be split with elements `x`, `y`, `depth`, `bnds` (list with elements `x` and `y`), `expn`, `n`

minExp

numeric giving the minimum expected count allowed in a bin

squarify

logical value, should we force splitting on the longer side?

Author

Chris Salahub

Details

This function samples a coordinate uniformly along a random margin and splits a bin at that coordinate. In contrast to maxScoreSplit with randScores, this can introduce splits at locations other than the points.

Examples

Run this code
bin <- makeBin(x = 1:10, y = sample(1:10))
rUnifSplit(bin, minExp = 2)

Run the code above in your browser using DataLab