Description Usage Arguments Value Examples
Given a treebinr object, trim
removes all leaves with measure values less than one specified by the user
1 2 |
val |
The largest value of measure to be removed |
treebinr_obj |
An object of class treebinr |
getMeasure |
A user supplied function to compute the measure to be compared between bins. By default, returns whatever value is in the measure slot of the bin object. |
binMeasure |
A user supplied function to compute the measure associated with each bin |
makePoint |
A user supplied function to turn the contents of a bin into a single point |
updateBin |
A user supplied function combine several bins into a single bin |
inputs |
A list containing additional input parameters required by user supplied functions |
The return value is an object of class treebinr, which contains the following
points |
A matrix containing the reduced point configuration |
counts |
A vector containing the number of points in each bin |
bins |
A list containing bin objects, which detail the contents of each bin |
tree |
An undirected graph object for the binning tree |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #Bin a Normal Configuration to 500 Points
set.seed(1337)
X <- matrix(rnorm(2000),ncol=2)
numbins <- 500
nCols <- ncol(X)
binMeasure <- gapMeasure
selectBin <- gapSelect
splitBin <- gapSplit
boundaryTest <- gapBoundaryTest
makePoint <- gapPoints
inputs <- list(dimRange = sapply(1:nCols, FUN = function(j) {range(X[,j])}), binsperdim = 10)
binInfo <- list(binRange = sapply(1:nCols, FUN = function(j) {range(X[,j])}))
treebin_obj <- treebin(X, numbins, binMeasure, boundaryTest, selectBin, splitBin, makePoint, binInfo, inputs)
#Trim all values of measure less than 0.01
val <- .01
updateBin <- gapUpdate
getMeasure <- function(bin, inputs){
max <- max(bin@measure)
return(max)
}
out <- trim(val, treebin_obj, getMeasure, binMeasure, makePoint, updateBin, inputs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.