【问题标题】:Can I change where RStudio saves snippets?我可以更改 RStudio 保存片段的位置吗?
【发布时间】:2019-03-27 01:00:10
【问题描述】:

我想更改 RStudio 保存存储我的代码 sn-ps 的 r.snippets 文件的位置。根据this site,RStudio 应该保存到~/.R/snippets/r.snippets。我在我的Renviron.site 文件中使用R_USER=C:/Users/JT/R 来设置~ 的位置。我认为这段代码有效,因为当我在 RStudio 中检查 ~ 的位置时,我得到:

> path.expand("~")
[1] "C:/Users/JT/R"

但是,当我在 RStudio 中编辑 sn-ps 时,它会在文件夹 C:\Users\JT\Documents\.R\snippets\ 中创建 r.snippets 文件。我希望将r.snippets 文件保存在文件夹C:\Users\JT\R\.R\snippets\ 中。

任何想法我做错了什么?谢谢。

【问题讨论】:

    标签: r rstudio code-snippets


    【解决方案1】:

    在 RStudio 社区网站上,同样的问题被问到 Can you change the directory the Rstudio looks for the r.snippets file?

    RStudio 员工 kevinushey 非常有帮助的回答是:

    虽然该目录当前不可配置,但您可能会走运 创建一个符号链接(或者,在 Windows 上,一个连接点)到 将 sn-ps 目录重新路由到另一个位置。

    tom_greenwood,提问的用户跟进了steps he used的详细信息:

    1. Put you existing r.snippets file in the new directory on the shared drive. I called mine 'snippet files'
    2. Delete the snippets directory which is inside the .R directory
    3. Run cdm as an administrator.
    4. Enter the command mklink /D "C:\Users\name.surname\Documents\.R\snippets" "T:\shared directory\snippet files"
    5. Restart Rstudio.
    

    【讨论】:

      猜你喜欢
      • 2011-02-19
      • 1970-01-01
      • 2014-11-22
      • 2016-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-03
      相关资源
      最近更新 更多