I want to change the prompt in R from > to R> and I know I should use the options command options(prompt="...") and it works, but then when I restart R the prompt is back to >.
Is there anyway to save the change so that it sticks?
Use .Rprofile file:
You can customize the R environment through a site initialization file or a directory initialization file. R will always source the
Rprofile.sitefile first. On Windows, the file is in theC:\Program Files\R\R-n.n.n\etcdirectory. You can also place a.Rprofilefile in any directory that you are going to run R from or in the user home directory.At startup, R will source the
Rprofile.sitefile. It will then look for a.Rprofilefile to source in the current working directory. If it doesn't find it, it will look for one in the user's home directory. There are two special functions you can place in these files..First( )will be run at the start of the R session and.Last( )will be run at the end of the session.