R/treesize.R

Defines functions treesize

Documented in treesize

#' Treesize
#' @export
treesize <- function(x, terminal=TRUE) {
  if(!inherits(x, "randomForest"))
    stop("This function only works for objects of class `randomForest'")
  if(is.null(x$forest)) stop("The object must contain the forest component")
  if(terminal) return((x$forest$ndbigtree+1)/2) else return(x$forest$ndbigtree)
}
sumbose/iRF documentation built on March 12, 2021, 7:36 a.m.