使R项目自动打开特定脚本 [英] Make R project Automatically open Specific Scripts

查看:137
本文介绍了使R项目自动打开特定脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am working in team, we mainly use R, I am quite used to use R project in Rstudio, which I like because when I open them I have all my scripts and everything at the right place. However when another member of the team opens one of my project it loads the values and data but does not open the R script (one can see that by physically clicking on the project through the windows explorer rather than using the menu at the top right in R). I guess something can be done in the .Rprofile but I did not find any command to open physically a script, I tried

file.edit("./Main.R") 

但是它没有打开任何东西.刚收到消息:

but it did not open anything. It just got me the message :

错误:找不到函数"file.edit"

Error: could not find function "file.edit"

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

As always, Thanks for your help !

**编辑 我尝试使用

**EDIT I tried to use

file.show
file.edit 
shell.exec(file.path(getwd()), "Main.R")) 

.pprofile中的

.没事.

in the .Rprofile. Nothing worked.

罗曼

推荐答案

file.edit需要utils软件包

file.edit requires the utils package

library(utils)
file.edit("Master.R")

但是,如果它在记事本中而不是RStudio中打开,则您和我有同样的问题.我尝试在所有可能的位置编辑editor=:.RProfile,RProfile,RProfile.sites,带有和不带有.First()函数语句和调用.但是,如果告知RStudio,则不会在RStudio中加载.R文件.它可能链接到.RProfile之后要加载的.RData文件.漏洞?或者至少RStudio应该在其RProject文件规范中包含一项功能.

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.

这篇关于使R项目自动打开特定脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆