irritable_phd_syndrom irritable_phd_syndrom - 1 year ago 134
R Question

Clear terminal in R-3.2.1 on CentOS 6, put cursor on top

I am aware of this question having already been asked, however neither

Option + Command + L
works for me.
cls <- function() cat(rep("\n",50))
works, however the cursor remains at the bottom of the screen.

I am using OS X Mavericks for my local machine and I am running R remotely (via ssh). I am using on my local machine to do so.

Note :
Control + Command + L
works if I, if on the server side, I launch an X11 window (via
) and run R from there. However, I don't particularly like working in an X11 window.

Note : in my
I have
set editing-mode vi
. I'm not sure if that will effect clearing the screen. It does not seem to be an issue in the X11 window.

QUESTION : How would I clear the screen while remotely running the command line version of R from and have the cursor be at the top?

Answer Source

From this answer :

clear <- function() cat(c("\033[2J","\033[0;0H"))

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download