[R] clear console
hi, I use R - 2.15(32bit), and want to make a code to clear a console. Actually, I used to run following code to do that but after update the version of R from 2.14 to 2.15, it doesn't work. cls - function (t) { require(RDCOMClient) wsh - COMCreate(Wscript.Shell) wsh$SendKeys(\f) invisible(wsh) } cls() or cls - function() { require(rcom) wsh -comCreateObject(Wscript.Shell) comInvoke(wsh, SendKeys, \f) invisible(wsh) } cls() Can anybody help me to solve this problem? Thanks. -- View this message in context: http://r.789695.n4.nabble.com/clear-console-tp4521532p4521532.html Sent from the R help mailing list archive at Nabble.com. __ 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] clear console
On Sat, Mar 31, 2012 at 8:09 AM, mrzung mrzun...@gmail.com wrote: hi, I use R - 2.15(32bit), and want to make a code to clear a console. Actually, I used to run following code to do that but after update the version of R from 2.14 to 2.15, it doesn't work. cls - function (t) { require(RDCOMClient) wsh - COMCreate(Wscript.Shell) wsh$SendKeys(\f) invisible(wsh) } cls() or cls - function() { require(rcom) wsh -comCreateObject(Wscript.Shell) comInvoke(wsh, SendKeys, \f) invisible(wsh) } cls() That is code that I originally posted on r-help 6 years ago-- https://stat.ethz.ch/pipermail/r-help/2006-February/088507.html The rcom version of that code still seems to work for me and I suspect the RDCOMClient one would work for me too except that RDCOMClient seems not yet available for R 2.15.0 (after checking a variety of repos using install.packages). install.packages did install rcom and it worked although the first time one runs it in the session it now gives an annoying popup message which did not occur six years ago. You might want to check what the differences are between your setup and mine: R.version.string [1] R version 2.15.0 Patched (2012-03-30 r58875) win.version() [1] Windows Vista (build 6002) Service Pack 2 packageVersion(rcom) [1] ‘2.2.3.1.1’ packageVersion(rscproxy) [1] ‘1.3.1’ -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ 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] clear console
Hello, Try cls2 - function(lines=25) cat(rep(\n, lines)) cls2() It's simpler, and doesn't need any special package. (In my system, R 2.14.1/Windows 7, i386 or x64, '\f' didn't work.) Hope this helps, Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/clear-console-tp4521532p4521663.html Sent from the R help mailing list archive at Nabble.com. __ 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] clear console
Will cat(rep(\n,30)) do? This does not remove any objects from the global environment. That requires ?rm -- Bert On Sat, Mar 31, 2012 at 5:09 AM, mrzung mrzun...@gmail.com wrote: hi, I use R - 2.15(32bit), and want to make a code to clear a console. Actually, I used to run following code to do that but after update the version of R from 2.14 to 2.15, it doesn't work. cls - function (t) { require(RDCOMClient) wsh - COMCreate(Wscript.Shell) wsh$SendKeys(\f) invisible(wsh) } cls() or cls - function() { require(rcom) wsh -comCreateObject(Wscript.Shell) comInvoke(wsh, SendKeys, \f) invisible(wsh) } cls() Can anybody help me to solve this problem? Thanks. -- View this message in context: http://r.789695.n4.nabble.com/clear-console-tp4521532p4521532.html Sent from the R help mailing list archive at Nabble.com. __ 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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ 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] clear console
On Sat, Mar 31, 2012 at 9:53 AM, Rui Barradas rui1...@sapo.pt wrote: Hello, Try cls2 - function(lines=25) cat(rep(\n, lines)) cls2() It's simpler, and doesn't need any special package. (In my system, R 2.14.1/Windows 7, i386 or x64, '\f' didn't work.) This may or may not be important but note that that leaves the cursor at the bottom of the screen -- not the top. -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ 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.