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?
You can put this line to .bashrc in your home directory or .zshrc if you use zsh.
alias R='R -q'
-q
means quiet.
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")
Adding
cat('\f')
to my .First() function in my .Rprofile works for me. I use Rstudio, (Windows 7, build 7601, Service Pack 1, x86)
Create a .Rprofile file that contains:
'cat("\014") # Clear console`
Change "Default working directory ..." in RStudio preferences to the folder that contains .Rprofile.
Update: as of November 2016, this now seems to work in RStudio 1.0.44 cat("\014")
. This is what I add to the top of my latest R scripts:
rm(list=ls()) # removes all objects from the environment
cat("\014") # clears the console
credit to @TMS for the solution
Note: it leaves the .Last.value as NULL in the environment, but I'm OK with that
There's a function '.First' that gets executed when you enter the console.
.First <- function(){
cat("\n")
}
This could do it.