如何使用 R 命令在 RStudio 中打开脚本文件? [英] How do I open a script file in RStudio using an R command?

查看:210
本文介绍了如何使用 R 命令在 RStudio 中打开脚本文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为 test.R 的简单脚本文件.它保存在工作目录中.当我转到 File >打开 >test.R,它在编辑器中打开文件(不执行代码,这是我想要的).

I have a simple script file called test.R. It's saved in the working directory. When I go to File > Open > test.R, it opens the file in the editor (without executing the code, which is what I want).

如何通过在控制台窗口中键入命令来执行此操作?明确地说,我只想打开(执行)文件.

How do I do this by typing a command in the console window? To be clear, I just want to open (not execute) the file.

推荐答案

您正在寻找 file.edit

file.edit('test.R')

应该在编辑器中打开文件(如果你在 RStudio,这应该默认为 RStudio)

should open the file in an editor (if you are in RStudio, this should default to RStudio)

这篇关于如何使用 R 命令在 RStudio 中打开脚本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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