清除 R / RStudio 中的启动屏幕
我想更改我第一次打开 R 或实际 Rstudio 时看到的启动/登录屏幕。我想要的只是 '>' 提示,没有其他任何东西。
我知道我以前在网上见过这个,但不记得搜索短语是什么。
我应该补充一点,我正在使用 Ubuntu Linux!
有什么建议吗?
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!
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
其他人给你建议如何停止这些消息,我会采取另一种方式:如何清除控制台。您可以手动按
Ctrl-L
。当然,最好以编程方式执行此操作并将适当的命令放在系统.RProfile
的末尾。我尝试了明显的解决方案:但这显然不起作用。您可以这样做:
这将清理您的控制台,但光标位于最后一行。或者您可以尝试此处提出的解决方案(我没有不过已经测试过 - 如果您尝试一下,请报告它是否有效):
在 Linux 控制台上,以下内容可以工作:
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:but this apparently doesn't work. You can do this:
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):
On linux console, the following could work:
您可以将此行放在主目录中的 .bashrc 中,如果使用 zsh,则可以将其放在 .zshrc 中。
-q
表示安静。You can put this line to .bashrc in your home directory or .zshrc if you use zsh.
-q
means quiet.添加
到我的 .Rprofile 中的 .First() 函数对我有用。我使用 Rstudio(Windows 7,内部版本 7601,Service Pack 1,x86)
Adding
to my .First() function in my .Rprofile works for me. I use Rstudio, (Windows 7, build 7601, Service Pack 1, x86)
创建一个 .Rprofile 文件,其中包含:
'cat("\014") # 清除控制台`
将 RStudio 首选项中的“默认工作目录...”更改为包含 .Rprofile 的文件夹。
Create a .Rprofile file that contains:
'cat("\014") # Clear console`
Change "Default working directory ..." in RStudio preferences to the folder that contains .Rprofile.
更新:截至 2016 年 11 月,这似乎可以在 RStudio 1.0.44
cat("\014")
中运行。这是我添加到最新 R 脚本顶部的内容:解决方案归功于 @TMS
注意:它在环境中将 .Last.value 保留为 NULL,但我对此表示同意
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:credit to @TMS for the solution
Note: it leaves the .Last.value as NULL in the environment, but I'm OK with that
当您进入控制台时,会执行一个函数“.First”。
这个可以做到。
There's a function '.First' that gets executed when you enter the console.
This could do it.