我可以更改RStudio保存代码片段的位置吗?
我想更改RStudio保存存储我的代码片段的我可以更改RStudio保存代码片段的位置吗?,r,rstudio,code-snippets,R,Rstudio,Code Snippets,我想更改RStudio保存存储我的代码片段的r.snippets文件的位置。根据,RStudio应该保存到~/.R/snippets/R.snippets。我在我的Renviron.site文件中使用R\u USER=C:/Users/JT/R来设置~的位置。我认为这段代码有效,因为当我检查RStudio中~的位置时,我得到: > path.expand("~") [1] "C:/Users/JT/R" 但是,当我在RStudio中编辑代码片段时,它会在文件夹C:\Users\JT\Do
r.snippets
文件的位置。根据,RStudio应该保存到~/.R/snippets/R.snippets
。我在我的Renviron.site
文件中使用R\u USER=C:/Users/JT/R
来设置~
的位置。我认为这段代码有效,因为当我检查RStudio中~
的位置时,我得到:
> path.expand("~")
[1] "C:/Users/JT/R"
但是,当我在RStudio中编辑代码片段时,它会在文件夹C:\Users\JT\Documents\.r\snippets\
中创建r.snippets
文件。我希望r.snippets
文件保存在C:\Users\JT\r\.r\snippets\
文件夹中
知道我做错了什么吗?谢谢。在RStudio社区网站上,同样的问题也被问到了 RStudio员工kevinushey的回答非常有用: 虽然该目录当前不可配置,但您可能会很幸运 创建指向的符号链接(或在窗口上创建连接点) 将代码段目录重新路由到其他位置 提出问题的用户tom_greenwood跟进了以下问题的详细信息:
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.