[R] Page eject and clearing the console

Sarah Goslee sarah.goslee at gmail.com
Tue Jan 4 18:00:58 CET 2011


Hi John,

I don't understand what you mean by "top of the next page", or rather,
how that differs from clearing the screen.

And for the latter, that is dependent on OS, and on GUI/console usage,
and has been discussed several times on the list. The easiest solution
is to invoke the system command if running in a console. For linux,
that would be:
system("clear")

A Google search using the exact words from your question found several
more options, including a discussion of doing this in Windows.
http://www.google.com/search?q=R+code+to+clear+the+console

I can't test them for you, but since I don't know if you're using Windows
or not it may not matter.

Sarah


On Tue, Jan 4, 2011 at 11:54 AM, John Sorkin
<jsorkin at grecc.umaryland.edu> wrote:
> (1) I know that \n when used in cat, e.g. cat("\n") produces a line feed (i.e. skips to the next line). Is there any escape sequence that will go to the top of the next page?
> (2) I know that control L will clear the console. Is there an equivalent function or other means that can be used in R code to clear the console?
>
> Thanks,
> John
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list