私は、 2 つの目的を持つ.Rprofile
次の関数を定義しました。.First
- 利用可能なライブラリ パスを表示する
colorout
RStudio を明るいテーマで実行している場合は、パッケージの設定を変更します.First <- function() { if (interactive()) { cat( "\nProcessed RProfile at:", date(), "\n", "Available libraries", "\n", paste(.libPaths(), collapse = "\n "), "\n" ) # Check if running bright theme and adjust colour settings if (assertive::is_rstudio()) { theme_info <- rstudioapi::getThemeInfo() if (!theme_info$dark) { colorout::setOutputColors( normal = 2, negnum = 3, zero = 3, number = 3, date = 3, string = 6, const = 5, false = 5, true = 2, infinite = 5, index = 2, stderror = 4, warn = c(1, 0, 1), error = c(1, 7), verbose = TRUE, zero.limit = NA ) } } } }
問題
ただし、.First
関数によって生成されるコンテンツは表示されません。
また、色の設定は適用されないようです。関数をソースして呼び出すと、.First()
問題なく動作します。
ターミナルで実行され、同じにアクセスするRセッションと同等の結果が得られないというRStudioの起動の違いを理解したい.Rprofile
ですか?