R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("rpart.permutation-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('rpart.permutation') Loading required package: rpart Loading required package: snow > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "doRpartPemutationTest" > > ### * doRpartPemutationTest > > flush(stderr()); flush(stdout()) > > ### Name: doRpartPermutationTest > ### Title: Function to permutation test an rpart model. > ### Aliases: doRpartPermutationTest > ### Keywords: tree > > ### ** Examples > > data(iris); > fit <- rpart(Species~., data=iris); > fit <- doRpartPermutationTest(dataset=iris, responseidx=5, model=fit, + formula=Species~., nperms=100, nprocs=1); > printcp(fit); Classification tree: rpart(formula = Species ~ ., data = iris) Variables actually used in tree construction: [1] Petal.Length Petal.Width Root node error: 100/150 = 0.66667 n= 150 CP nsplit rel error xerror xstd Rpvalue Xpvalue nreps 1 0.50 0 1.00 1.17 0.050735 NA NA NA 2 0.44 1 0.50 0.73 0.061215 0.0070423 0.0070423 142 3 0.01 2 0.06 0.09 0.029086 0.0099010 0.0099010 101 > #> CP nsplit rel error xerror xstd Rpvalue Xpvalue nreps > #>1 0.50 0 1.00 1.21 0.04836666 NA NA NA > #>2 0.44 1 0.50 0.80 0.06110101 0.008196721 0.008196721 122 > #>3 0.01 2 0.06 0.11 0.03192700 0.009900990 0.009900990 101 > > > > > ### *