使 R 项目自动打开特定脚本

Rom*_*ain 6 r file project rstudio

我在团队中工作,我们主要使用 R,我非常习惯在 Rstudio 中使用 R 项目,我喜欢它,因为当我打开它们时,我的所有脚本和所有内容都在正确的位置。但是,当团队的另一名成员打开我的一个项目时,它会加载值和数据,但不会打开 R 脚本(可以通过 Windows 资源管理器物理单击项目而不是使用右上角的菜单来查看这一点) R)。我想可以在 .Rprofile 中完成一些操作,但我没有找到任何物理打开脚本的命令,我试过了

file.edit("./Main.R") 
Run Code Online (Sandbox Code Playgroud)

但它没有打开任何东西。它刚刚给我的消息:

错误:找不到函数“file.edit”

一如既往,感谢您的帮助!

**编辑我尝试使用

file.show
file.edit 
shell.exec(file.path(getwd()), "Main.R")) 
Run Code Online (Sandbox Code Playgroud)

在 .Rprofile 中。没有任何效果。

罗曼

小智 1

file.edit 需要 utils 包

library(utils)
file.edit("Master.R")
Run Code Online (Sandbox Code Playgroud)

However, if it opens in Notepad rather than RStudio you have the same problem as me. I've tried editing the editor= in all possible places: .RProfile, RProfile, RProfile.sites, with and without .First() function statements and calls. However, RStudio does not load the .R file in RStudio if told to. It may be linked to the .RData file being loaded after .RProfile. Bug? Or at least a feature RStudio should incorporate in their RProject file specification.