I am looking for a way to test if R is being run from RStudio. For some reason I could find the answer on google yesterday but not today, but I think it had to do with testi
Check the .Platform$GUI option for "RStudio"
.Platform$GUI
"RStudio"
is.rstudio = function(){ .Platform$GUI == "RStudio" }
See:
http://thecoatlessprofessor.com/programming/detecting-if-r-is-in-rstudio-and-changing-rstudios-default-graphing-device/