
Splits a bin based on the location maximizing a score function with restrictions on minimum bin size.
maxScoreSplit(bin, scorer, minExp = 5, squarify = FALSE)
A list of two bins resulting from the split of `bin` along the corresponding margin at the maximum location
a bin to be split with elements `x`, `y`, `depth`, `bnds` (list with elements `x` and `y`), `expn`, `n`
function which accepts a numeric vector of potential split coordinates and the bounds of `bin` and returns a numeric vector of scores for each
value giving the smallest expected count allowed for bin splits
logical value, should we force splitting on the longer side regardless of scores?
Chris Salahub
This function serves as a wrapper which manages the logic of splitting bins using a score function while maintaining a minimum size and allowing forced splits along the wider edge.
bin <- makeBin(x = 1:10, y = sample(1:10))
maxScoreSplit(bin, chiScores)
maxScoreSplit(bin, miScores) # pretty similar for both
maxScoreSplit(bin, randScores)
maxScoreSplit(bin, randScores) # different every time
Run the code above in your browser using DataLab