[R] Delete rpart/mvpart cross-validation output

Matt Shotwell shotwelm at musc.edu
Wed Aug 18 15:21:34 CEST 2010


Or, if using GNU Linux or other UNIX-like system:

sink("/dev/null")
# Issue commands
sink()

-Matt

On Wed, 2010-08-18 at 09:14 -0400, Gabor Grothendieck wrote:
> On Fri, Aug 13, 2010 at 1:52 PM, Marie-Hélène Ouellette
> <marieheleneo at gmail.com> wrote:
> > Dear all,
> >
> > I was wondering if there is a simple way to avoid printing the multiple
> > cross-validation automatic output to the console of recursive partitionning
> > functions like rpart or mvpart. For example...
> >
> >> data(spider)
> >>
> > mvpart(data.matrix(spider[,1:12])~herbs+reft+moss+sand+twigs+water,spider,xv="1se",xvmult=100)
> > *X-Val rep : 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  27  28  29  30  31  32  33  34  35  36  37
> > 38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56
> > 57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75
> > 76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94
> > 95  96  97  98  99  100
> > Minimum tree sizes
> > tabmins
> >  4  6  7  8
> >  2 18 78  2 *
> >
> > ... loosing what's in bold ?
> >
> 
> Try this hack:
> 
> cat <- function(...) if (..1 != " " && ..1 != "X-Val rep : 1") base::cat(...)
> environment(mvpart) <- .GlobalEnv
> 
> mvpart(data.matrix(spider[,1:12])~herbs+reft+moss+sand+twigs+water,spider,xv="1se",xvmult=100)
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Matthew S. Shotwell
Graduate Student 
Division of Biostatistics and Epidemiology
Medical University of South Carolina



More information about the R-help mailing list