Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear startup screen in R / RStudio

Tags:

r

rstudio

I would to change the start up/ logon screen that I get when I first open up R or actually Rstudio. What I would like to have is just the '>' prompt and nothing else.

I know I have seen this on the web before but can't remember what the search phrase was.

I should have added that I am using Ubuntu Linux 10.04!
Any suggestions?

My console in RStudio

like image 965
mccurcio Avatar asked Oct 14 '11 17:10

mccurcio


People also ask

How do you clear the screen in RStudio?

Ctrl+L — Clear the Console.

How do I run code in R?

To run an R command, put the cursor on the line of the command and then click the Run button at the top of the file window. Or just press CTRL-Enter.

Which of the following are a part of RStudio?

RStudio has four main panes each in a quadrant of your screen: Source Editor, Console, Workspace Browser (and History), and Plots (and Files, Packages, Help).


1 Answers

Other guys are giving you advice how to stop the messages, I will take it the other way: how to clear the console. You can press Ctrl-L manually. Of course, it would be nice to do this programmatically and place the appropriate command at the end of your system .RProfile. I tried the obvious solution:

cat("\014") # or cat("\f")

but this apparently doesn't work. You can do this:

cat(rep("\n", 50))

which will clean your console, but the cursor is at the last line. Or you may try the solution proposed here (I've not tested it though - please report if it works if you try it):

cls <- function() {
       require(rcom)
       wsh <- comCreateObject("Wscript.Shell")
       comInvoke(wsh, "SendKeys", "\014")
       invisible(wsh)
} 

On linux console, the following could work:

system("clear")
like image 157
Tomas Avatar answered Sep 26 '22 01:09

Tomas