Skip to content
Prev 86587 / 398502 Next

how to clear screen in R-console?

Hi,

depends on what type of terminal you are running.  For example, if you
run R in a VT100 terminal, you can try

cat("The following VT100 escape sequence will clear the screen on a
VT100 terminal\n")
cat("\033[2J")  # <ESC>[2J  == Clear Screen
cat("If the screen was cleared you should only see this sentence.\n")

i.e.

vt100ClearScreen <- function(...) cat("\033[2J")

Some links:
http://www.fh-jena.de/~gmueller/Kurs_halle/esc_vt100.html
http://en.wikipedia.org/wiki/VT100

Note, this is not guaranteed to work everywhere.  To the best of my
knowledge, you will not be able to do anything like this in Rgui on
Windows.

Cheers

Henrik
On 2/16/06, Michael <comtech.usa at gmail.com> wrote:
--
Henrik Bengtsson
Mobile: +46 708 909208 (+1h UTC)