Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我可以更改RStudio保存代码片段的位置吗?_R_Rstudio_Code Snippets - Fatal编程技术网

我可以更改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

我想更改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\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.