R/printcp.R

`printcp` <-
function(x, digits=.Options$digits - 2)
{
    if(!inherits(x, "rpart")) stop("Must be an rpart x")
    #cat(switch(x$method, 
    # anova="\nRegression tree:\n", 
    # class="\nClassification tree:\n", 
    # poisson="\nRates regression tree:\n", 
    # exp="\nSurvival regression tree:\n"))
    #if(!is.null(cl <- x$call)) {
    # dput(cl)
    # cat("\n")
    #}
    frame <- x$frame
    leaves <- frame$var == "<leaf>"
    used <- unique(frame$var[!leaves])
    #if(!is.null(used)) {
    # cat("Variables actually used in tree construction:\n")
    # print(sort(as.character(used)), quote=F)
    # cat("\n")
    #}
    #cat("Root node error: ", format(frame$dev[1], digits=digits), "/", 
    #frame$n[1], "=", format(frame$dev[1]/frame$n[1], digits=
    #digits), "\n\n", sep="")
    n <- x$frame$n
    omit <- x$na.action
    if(length(omit))
        cat("n=", n[1], " (", naprint(omit), ")\n\n", sep="")
    #else cat("n=", n[1], "\n\n")
    #print(x$cptable, digits=digits)
    invisible(x$cptable)
}

Try the BIOMOD package in your browser

Any scripts or data that you put into this service are public.

BIOMOD documentation built on May 2, 2019, 6:48 p.m.