halfCutTie | R Documentation |
This function halves a bin based on the midpoint of the bounds along whichever margin produces the larger score.
halfCutTie(bin, xscore, yscore, wider, squarify = FALSE)
bin |
a bin to be split with elements 'x', 'y', 'depth', 'bnds' (list with elements 'x' and 'y'), 'expn', 'n' |
xscore |
numeric value giving the score for all splits along x |
yscore |
numeric value giving the score for all splits along y |
wider |
logical; is the bin wider than it is tall? |
squarify |
logical value, should we force splitting on the longer side regardless of scores? |
The goal of this function is to break ties within bin splitting in a way which prevents very small or lopsided bins from forming, a common problem with the 'halfSplit' function
A list of two bins resulting from the split of 'bin' in half along the margin corresponding to the larger score.
Chris Salahub
bin <- makeBin(x = 1:10, y = sample(1:10))
halfCutTie(bin, 1, 2, wider = FALSE) # splits on y
halfCutTie(bin, 2, 1, wider = FALSE) # splits on x
halfCutTie(bin, 1, 1, wider = FALSE) # ties are random
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.