Charles Annis, P.E.
2006-Sep-29 02:12 UTC
[R] control L to clear the Rgui screen in Windows
Greetings R-ians: Searching the Searchable Mail Archives I discovered that ctrl L will clear the Rgui screen, which is what I'd like to do from a print (or some similar) statement. Is there a mechanism to use the ctrl L clear-screen sequence in a script, or print statement? Thanks for your counsel. Charles Annis, P.E. Charles.Annis at StatisticalEngineering.com phone: 561-352-9699 eFax:? 614-455-3265 http://www.StatisticalEngineering.com ?
This I got from a previous answer. You require the package 'rcom'
cls.console <- function() {
if (.Platform$GUI[1] != "Rgui")
return(invisible(FALSE))
if (!require(rcom, quietly = TRUE)) # Not shown any way!
stop("Package rcom is required for 'cls()'")
wsh <- comCreateObject("Wscript.Shell")
if (is.null(wsh)) {
return(invisible(FALSE))
} else {
comInvoke(wsh, "SendKeys", "\014")
return(invisible(TRUE))
}
}
On 9/28/06, Charles Annis, P.E.
<Charles.Annis at statisticalengineering.com>
wrote:> Greetings R-ians:
>
> Searching the Searchable Mail Archives I discovered that ctrl L will clear
> the Rgui screen, which is what I'd like to do from a print (or some
similar)
> statement.
>
> Is there a mechanism to use the ctrl L clear-screen sequence in a script,
or
> print statement?
>
> Thanks for your counsel.
>
> Charles Annis, P.E.
>
> Charles.Annis at StatisticalEngineering.com
> phone: 561-352-9699
> eFax: 614-455-3265
> http://www.StatisticalEngineering.com
>
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
Gabor Grothendieck
2006-Sep-29 02:35 UTC
[R] control L to clear the Rgui screen in Windows
See: http://tolstoy.newcastle.edu.au/R/help/06/02/21556.html On 9/28/06, Charles Annis, P.E. <Charles.Annis at statisticalengineering.com> wrote:> Greetings R-ians: > > Searching the Searchable Mail Archives I discovered that ctrl L will clear > the Rgui screen, which is what I'd like to do from a print (or some similar) > statement. > > Is there a mechanism to use the ctrl L clear-screen sequence in a script, or > print statement? > > Thanks for your counsel. > > Charles Annis, P.E. > > Charles.Annis at StatisticalEngineering.com > phone: 561-352-9699 > eFax: 614-455-3265 > http://www.StatisticalEngineering.com > > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >
Charles Annis, P.E.
2006-Sep-29 03:15 UTC
[R] SUMMARY control L to clear the Rgui screen in Windows
Eternal thanks to Jim Holtman and to Gabor Grothendieck who pointed me to
this concise piece of code:
cls <- function() {
require(rcom)
wsh <- comCreateObject("Wscript.Shell")
comInvoke(wsh, "SendKeys", "\014")
invisible(wsh)
}
Perfect!
Thanks!
Charles Annis, P.E.
Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax: 614-455-3265
http://www.StatisticalEngineering.com
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Charles Annis, P.E.
Sent: Thursday, September 28, 2006 10:13 PM
To: R-help at stat.math.ethz.ch
Subject: [R] control L to clear the Rgui screen in Windows
Greetings R-ians:
Searching the Searchable Mail Archives I discovered that ctrl L will clear
the Rgui screen, which is what I'd like to do from a print (or some similar)
statement.
Is there a mechanism to use the ctrl L clear-screen sequence in a script, or
print statement?
Thanks for your counsel.
Charles Annis, P.E.
Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax:? 614-455-3265
http://www.StatisticalEngineering.com
?
______________________________________________
R-help at stat.math.ethz.ch 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.