如何在RStudio动态开关的RON架构 [英] How switch R architectures dynamically in RStudio

查看:146
本文介绍了如何在RStudio动态开关的RON架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在RStudio有一个工具菜单,让您在选择R的安装版本/建筑全局选项

In RStudio there's a Tools menu which allows you to select an installed version/architecture of R under Global Options.

这是伟大的,但我的这个问题是这样的,顾名思义,它是一个全球选项,所以一旦你选择一个不同的体系结构(或版本号),那么你必须重新启动RStudio它适用于全部您RStudio实例和项目。

That's great, but my issue with that is that, as the name implies, it is a Global option, so once you select a different architecture (or version number) you then have to restart RStudio and it applies to all of your RStudio instances and projects.

这对我来说是一个问题,因为:

This is a problem for me because:


  • 我因为他们正在与32位的数据库,如Hortonworks的Hadoop
  • 接口的事实给定的项目中一些脚本,严格要求的32位R
  • 我的其它脚本的同一个项目的其中严格规定的64位R,由于(a)某些包的可用性和内(B)内存限制是在32位R上过于小我的操作系统

  • I have some scripts within a given project that strictly require 32-bit R due to the fact that they're interfacing with 32-bit databases, such as Hortonworks' Hadoop
  • I have other scripts within the same project which strictly require 64-bit R, due to (a) availability of certain packages and (b) memory limits being prohibitively small in 32-bit R on my OS

我们可以称之为问题#1,这也是因为我有这需要一个特定的架构某些项目的问题,虽然在项目中的所有脚本中使用相同的架构(这​​理论上应该是一个容易解决的问题,我们可以称之为问题#2)。

which we can call "Issue #1" and it's also a problem because I have certain projects which require a specific architecture, though all the scripts within the project use the same architecture (which should theoretically be an easier to solve problem that we can call "Issue #2").

如果我们能解决问题#1,那么问题2解决为好。如果我们能解决问题2:我还是会更好,即使问题#1解决。

If we can solve Issue #1 then Issue #2 is solved as well. If we can solve Issue #2 I'll still be better off, even if Issue #1 is unsolved.

我基本上问如果任何人有一个黑客,解决方法,或者更好的工作流程,以满足这一需要频繁交换架构和/或需要同时为不同的项目运行在不同的R / RStudio会议不同的架构定期基础。

I'm basically asking if anyone has a hack, work-around, or better workflow to address this need for frequently switching architectures and/or needing to run different architectures in different R/RStudio sessions simultaneously for different projects on a regular basis.

我知道,这个功能可能会重新present为RStudio功能请求,如果这个问题不适合计算器出于这个原因然后让我知道,我会删除它。我只是想通了很多其他人可能有这个问题,所以也许有人已经找到了解决方法/破解?

I know that this functionality would probably represent a feature request for RStudio and if this question is not appropriate for StackOverflow for that reason then let me know and I'll delete it. I just figured that a lot of other people probably have this issue, so maybe someone has found a work-around/hack?

推荐答案

有没有简单的方法来做到这一点,但也有一些解决方法。一,你可能会考虑通过系统2 调用启动从R的当前位的味道R的正确位的味道 Rscript.exe ,例如: (未经测试code):

There's no simple way to do this, but there are some workarounds. One you might consider is launching the correct bit-flavor of R from the current bit-flavor of R via system2 invoking Rscript.exe, e.g. (untested code):

source32 <- function(file) {
  system2("C:\\Program Files\\R\\R-3.1.0\\bin\\i386\\Rscript.exe", normalizePath(file)) 
}
...
# Run a 64 bit script
source("my64.R")

# Run a 32 bit script
source32("my32.R")

当然,这并没有真正给你一个32位的互动环节这么多,运行code作为32位的能力。

Of course that doesn't really give you a 32 bit interactive session so much as the ability to run code as 32 bit.

另外一个提示:如果你按住CTRL的同时发动RStudio,你可以挑选第r风味和位数为启动时启动。这会,如果你切换了大量节省您的时间。

One other tip: If you hold down CTRL while launching RStudio, you can pick the R flavor and bitness to launch on startup. This will save you some time if you're switching a lot.

这篇关于如何在RStudio动态开关的RON架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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