Re: [R] Delete rpart/mvpart cross-validation output
Hi Marie and Gavin, I do remember there is some command doing silent, so to suppress output (as if directing it to sink, but not really directing it anywhere). The problem is I don't remember the command at the moment - but some searching might yield you results. Cheers, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Tue, Aug 17, 2010 at 6:13 PM, Gavin Simpson gavin.simp...@ucl.ac.ukwrote: On Fri, 2010-08-13 at 14:52 -0300, Marie-Hélène Ouellette wrote: Dear all, I've been away for several weeks but I don't see an answer on the list so... 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... Unfortunately, no. These messages are hardcoded in the mvpart function and printed using cat( ) calls. This is unfortunate as a verbose or trace argument and appropriate if(verbose) statements before these calls to cat would have allowed you to turn off the statements printed. One way to achieve something similar would be to use sink() and then unlink() the file to which output has been diverted. (unlinking a file deletes it.) sink(foo.FOO) mod - mvpart(data.matrix(spider[,1:12])~herbs+reft+moss+sand+twigs +water,spider,xv=1se,xvmult=100) sink() unlink(foo.FOO) Depends on what you had in mind and why you wanted to suppress the output. You could do fix(mvpart) and edit the function to remove the calls to cat() as required. 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 ? HTML mail is not advocated on this list, and in plain text, all the bold formatting is lost. HTH G Thank you for your time, MH [[alternative HTML version deleted]] __ R-help@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. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@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. [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Delete rpart/mvpart cross-validation output
On Fri, Aug 13, 2010 at 1:52 PM, Marie-Hélène Ouellette mariehele...@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@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.
Re: [R] Delete rpart/mvpart cross-validation output
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 mariehele...@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@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 __ R-help@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.
Re: [R] Delete rpart/mvpart cross-validation output
Try this also: invisible(capture.output(x - mvpart(data.matrix(spider[,1:12])~herbs+reft+moss+sand+twigs+water,spider,xv=1se,xvmult=100))) x On Fri, Aug 13, 2010 at 2:52 PM, Marie-Hélène Ouellette mariehele...@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 ? Thank you for your time, MH [[alternative HTML version deleted]] __ R-help@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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Delete rpart/mvpart cross-validation output
On Wed, Aug 18, 2010 at 9:14 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Fri, Aug 13, 2010 at 1:52 PM, Marie-Hélène Ouellette mariehele...@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) Here it is wrapped into a function: mvpart - function(...) { cat - function(...) if (..1 !=..1 != X-Val rep : 1) base::cat(...) mvpart - mvpart::mvpart environment(mvpart) - environment() mvpart(...) } mvpart(data.matrix(spider[,1:12])~herbs+reft+moss+sand+twigs+water,spider,xv=1se,xvmult=100) __ R-help@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.
Re: [R] Delete rpart/mvpart cross-validation output
On Fri, 2010-08-13 at 14:52 -0300, Marie-Hélène Ouellette wrote: Dear all, I've been away for several weeks but I don't see an answer on the list so... 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... Unfortunately, no. These messages are hardcoded in the mvpart function and printed using cat( ) calls. This is unfortunate as a verbose or trace argument and appropriate if(verbose) statements before these calls to cat would have allowed you to turn off the statements printed. One way to achieve something similar would be to use sink() and then unlink() the file to which output has been diverted. (unlinking a file deletes it.) sink(foo.FOO) mod - mvpart(data.matrix(spider[,1:12])~herbs+reft+moss+sand+twigs +water,spider,xv=1se,xvmult=100) sink() unlink(foo.FOO) Depends on what you had in mind and why you wanted to suppress the output. You could do fix(mvpart) and edit the function to remove the calls to cat() as required. 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 ? HTML mail is not advocated on this list, and in plain text, all the bold formatting is lost. HTH G Thank you for your time, MH [[alternative HTML version deleted]] __ R-help@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. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@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.