清理R控制台中的启动消息(.RProfile)

时间:2017-11-09 14:08:16

标签: r

我正在写一个.Rprofile,我似乎无法摆脱控制台中启动消息的特定部分。

首先,我想在新的R会话开始时抑制或跳过版本信息。

R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Another thread展示了如何在从控制台启动R时抑制消息,但是在RStudio中加载项目时是否也可以? Three years ago有人说这是开发人员的待办事项。

我尝试了一种不同的方法,开始.Rprofile cat("\014")(如here所示),但这会以某种方式清除控制台,包括之后打印的消息。

以下是相关代码:

cat("\014")

# A fun welcome message
message("Hi, welcome to your Data Analysis Project")

if(interactive()) 
  try(fortunes::fortune(), silent = TRUE)

有了这个,我在启动时最终得到一个完全空的控制台。

最终,我想在启动时结束这个控制台:

Hi, welcome to your Data Analysis Project

Uwe Ligges: I just told nonsense, stepclass() does not make sense with
randomForest(), obviously ... (wonder why nobody shouted?).
Douglas Bates: Oh, we're just so used to you talking nonsense that we don't
bother to point it out any more :-)
   -- Uwe Ligges and Douglas Bates
      R-help (July 2005)
>

0 个答案:

没有答案