Mathematica 12.1 adds support for R in the ExternalLanguage cell. But this does not work out of the box.

enter image description here

Mathematica downloads very old RLinkRuntime-Windows- (R 2.14!).

enter image description here

How to enable R in the ExternalLanguage cell?

  • 3
    $\begingroup$ Related Q/A $\endgroup$ Commented Mar 24, 2020 at 9:05
  • $\begingroup$ @LeonidShifrin I did not see this question. Should I delete mine as a duplicate? $\endgroup$ Commented Mar 24, 2020 at 9:13
  • $\begingroup$ I don't think yours is exact dupe, because that one was concerned with using R packages, which is a slightly different topic. So I would definitely keep this one too. $\endgroup$ Commented Mar 24, 2020 at 9:15
  • $\begingroup$ Worked out of the box on Mathematica 12.1.0 for Mac OS X x86 (64-bit) (March 14, 2020) (after automatically installing R). $\endgroup$
    – Chris K
    Commented Mar 24, 2020 at 16:46

1 Answer 1


On Windows:

  1. download and install R: https://cloud.r-project.org/ The installation directory is C:\R in my case.

  2. run R and evaluate: install.packages('rJava')

  3. fix C:\Mathematica\SystemFiles\Components\ExternalEvaluate_R\ExternalEvaluate\R.wl: InstallR["RHomeLocation"->"C:\\R","NativeLibLocation"->"C:\\R\\library\\rJava\\jri\\x64"]

  4. enjoy R in the ExternalLanguage cell:

enter image description here

enter image description here

  • 2
    $\begingroup$ +1, that will certainly work, although this method is probably more intruding than one would like. We will make an effort to support the choice of R versions through ExtrernalEvaluate out of the box a.s.a.p. $\endgroup$ Commented Mar 24, 2020 at 9:07
  • 3
    $\begingroup$ Some more details on using RLink with modern versions of R were also discussed here $\endgroup$ Commented Mar 24, 2020 at 9:08
  • $\begingroup$ What about RStudio? $\endgroup$
    – user5601
    Commented Mar 25, 2020 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.