[R] clear console
Gabor Grothendieck
ggrothendieck at gmail.com
Sat Mar 31 16:06:14 CEST 2012
On Sat, Mar 31, 2012 at 8:09 AM, mrzung <mrzung46 at 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
More information about the R-help
mailing list