【问题标题】:What is the difference betwwen `Rprofile`,`Renviron` and `Rprofile.site`,`Renviron.site`?`Rprofile`、`Renviron` 和 `Rprofile.site`、`Renviron.site` 有什么区别?
【发布时间】:2013-04-13 03:13:48
【问题描述】:

在我的电脑里:

  1. /etc/R 中有三个文件 RenvironRprofile.site,Renviron.site , 我在任何地方都找不到Rprofile。这是一个适当的状态吗?

  2. Rprofile,RenvironRprofile.site,Renviron.site 有什么区别?

【问题讨论】:

  • 这几乎肯定在?Startup 中得到了回答,尽管我承认那里的文档可能有点难以阅读。
  • @it_is_a_literature:您似乎在没有明确搜索 R 帮助系统或现有 StackOverflow 问题的语料库的情况下提出问题。这不会是一个成功的策略。

标签: r


【解决方案1】:

文件的名称是.Rprofile,而不是Rprofile。在 SO 中搜索 '[r] .rprofile' 并找到此答案后,我得到了此代码:Locate the ".Rprofile" file generating default options

file.path(getwd(), ".Rprofile") 
[1] "/Users/davidwinsemius/.Rprofile"

大多数操作系统会隐藏“点文件”/“系统文件”,除非你强制它们变得可见。

您将在?Startup 帮助页面中找到描述的各种文件。 .Renviron 文件应该描述系统资源的设置和位置;从`?启动

站点或用户环境文件中的行应该是以 # 开头的注释行,或者格式为 name=value 的行。后者将环境变量名称设置为 value,覆盖现有值。

因此,键值对将用于将这些对推送到系统环境变量表中。 Rprofile.site 应该包含为网络上的每个人创建起始条件的代码,可能是共享选项,例如 stringsAsFactors=FALSE 的设置,

...和.Rprofile 包含个人用户设置和控制的代码,可能是用户定义的函数或要在启动时加载的包。

Josh 引用了 @flodel 的一个值得研究的答案:Locate the ".Rprofile" file generating default options

【讨论】:

    【解决方案2】:

    我有一个类似于 OP 的问题 2 的问题,但特别关注 .Rprofile 和 Rprofile.site 文件之间的区别。

    根据我从 ?Startup 收集到的信息以及关于 SO 的其他一些答案,这是我对这种差异的理解:

    Rprofile.site 是站点范围的启动配置文件 - 它在 .Rprofile 之前被搜索并运行,它将覆盖基本包。 .Rprofile 是一个用户启动配置文件,它在 Rprofile.site 之后被搜索和获取,并将内容加载到工作区中,而不是覆盖基本包。

    我还发现this answer here 有助于理解差异。

    【讨论】:

      【解决方案3】:

      我发现this article 对回答 OP 的第二个问题很有用,“Rprofile、Renviron 和 Rprofile.site、Renviron.site 有什么区别?”本质上,Rxxx.site 包含特定于站点(即当前计算机)的设置,而 .Rxxx 包含特定于项目或用户的设置。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2010-10-02
        • 2011-12-12
        • 2010-09-16
        • 2012-03-14
        • 2012-02-06
        • 2011-02-25
        • 2011-11-22
        相关资源
        最近更新 更多