How to set up conda-installed R for use with RStudio?

后端 未结 5 1319
栀梦
栀梦 2020-12-13 10:22

I\'ve been trying to set up my R using conda (eventually to use with Beaker Notebook) and I want to be able to use RStudio wi

5条回答
  •  不思量自难忘°
    2020-12-13 10:39

    Update: ADD THIS TO ~/.bash_profile !

    export RSTUDIO_WHICH_R="/Users/jespinoz/anaconda/bin/R"
    launchctl setenv RSTUDIO_WHICH_R $RSTUDIO_WHICH_R
    

    Credits to @Z-Shiyi for the last line https://github.com/conda/conda/issues/3316#issuecomment-241246755


    An addition to what @Ray Donnelly said above. Basically, it has to be executed from the correct environment (i.e. run it from the terminal).

    You can either:

    (A) Put this in your ~/.bash_profile export RSTUDIO_WHICH_R=/Users/[yourusername]/anaconda/bin/R (if youre using conda but you could put any R path)

    (B) then type this in the terminal after it's been sourced (either restart terminal or do source .bash_profile): open -a RStudio That should work.

    or you can do what I did:

    (A) open up automator (sorry if you're not on a mac; this will only work on mac)

    (B) use a Run Shell Script

    (C) then delete cat that's already in there and put in: export RSTUDIO_WHICH_R=/Users/[yourusername]/anaconda/bin/R open -a RStudio

    (D) Save it as something like run_rstudio.app then just run that and it should work:

提交回复
热议问题