同时运行多个 R 脚本 [英] Run multiple R-scripts simultaneously

查看:113
本文介绍了同时运行多个 R 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的论文中,我需要进行大量的模拟研究,这都需要很长时间.我的计算机有 4 个内核,所以我一直想知道是否可以通过让它们使用两个不同的内核来同时在 Rstudio 中运行两个 R 脚本?如果可以做到这一点,我可以通过让计算机过夜运行所有这些脚本来节省大量时间.

解决方案

EDIT:鉴于 RStudio 的增强,此方法不再是执行此操作的最佳方法 - 请参阅下面的 Tom Kelly 回答<小时>

假设结果不需要在相同的环境中结束,您可以使用 RStudio 项目来实现这一点:https://support.rstudio.com/hc/en-us/articles/200526207-Using-Projects

首先创建两个独立的项目.您可以同时打开两者,这将导致两次会话.然后您可以打开每个项目中的每个脚本,并分别执行每个脚本.然后由您的操作系统来管理核心分配.

In my thesis I need to perform a lot of simulation studies, which all takes quite a while. My computer has 4 cores, so I have been wondering if it is possible to run for example two R-scripts in Rstudio at the same time, by letting them use two different cores? If this could be done, I could be saving a lot of time by just leaving the computer over night running all these scripts.

解决方案

EDIT: Given enhancements to RStudio, this method is no longer the best way to do this - see Tom Kelly's answer below


Assuming that the results do not need to end up in the same environment, you can achieve this using RStudio projects: https://support.rstudio.com/hc/en-us/articles/200526207-Using-Projects

First create two separate projects. You can open both simultaneously, which will result in two rsessions. You can then open each script in each project, and execute each one separately. It is then on your OS to manage the core allocation.

这篇关于同时运行多个 R 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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