Different IDEs have their own quirks, so itβs sometimes useful to know which IDE you use to run R.
You can check if you are using RStudio by testing the RSTUDIO
environment RSTUDIO
.
is_rstudio <- function() { env <- Sys.getenv("RSTUDIO") !is.null(env) && env == "1" }
(Or, as Hadley noted, gui <- .Platform$GUI; !is.null(gui) && gui == "RStudio"
.)
You can check for Revolution R by checking the list named Revo.version
in the base environment.
is_revo_r <- function() { exists("Revo.version", "package:base", inherits = FALSE) && is.list(Revo.version) }
Is there a similar check that can be performed if you use Architect or StatET?
The closest I found is that, by default, Architect adds the path to the embedded copy of Rtools to the PATH environment variable.
strsplit(Sys.getenv("PATH"), ";")[[1]][1] ## [1] "D:\\Program Files\\Architect\\plugins\\eu.openanalytics.architect.rtools.win32.win32_0.9.3.201307232256\\rtools\\bin"
I donβt understand how to make a reliable cross-platform test from this. Can you find a better test?
source share