# Installing R for use with V11.3 on Windows 10

I can't install R on Windows 10. I tried some solutions that I found on the Internet, but they did not help.

Needs["RLink"]
InstallR[
"RHomeLocation" -> "X:\\Program Files\\R\\R-3.5.1",
"NativeLibLocation" ->
"X:\\Program Files\\R\\R-3.5.1\\library\\rJava\\jri\\x64"]


During evaluation of the above, I get

InstallR::fail: Failed to install R. The following error was encountered: Unable to load dynamic libraries

\$Failed

• Wolfram support will likely be better able to help than will we. Have you tried contacting them? – b3m2a1 Feb 11 at 23:54
• Yes, but I haven't received an answer yet. – Aleksei Zhidkov Feb 12 at 7:14
• There are actually two issues here: incompatibility with the more recent versions of R, and the bug that requires to call InstallR[] twice at first, for every session. Both have been fixed for 12.0. For the dll issues, you can use the answer here for the workaround. You will need to go to R console (for your R distro), and call install.packages("rJava") from there. Next, go to installed rJava package and locate there jri.dll in JRI folder, for your architecture (64 bit, I presume)... – Leonid Shifrin Feb 12 at 11:19
• Then use that location, for the setting of "NativeLibLocation" (look at the answer I linked). That should take care of the library issue. As to the other one, you will need to call InstallR[...] followed immediately by UninstallR[], and then InstallR[] again, at the start of the R session. After that, everything should work. Let me know if that does not work for you, I will look closer (don't have 11.3 installed at the moment). Sorry for this state of affairs, I should've fixed these issues earlier. – Leonid Shifrin Feb 12 at 11:22
• @b3m2a1 "Wolfram support will likely be better able to help than will we. Have you tried contacting them?" - correct in general, but in this particular case this path will likely lead to me, unless they have these workarounds available. – Leonid Shifrin Feb 12 at 20:23

With the help of reading @szabolcs RLink link which has the following:

Unfortunately, with recent versions of Mathematica and R on macOS, occasionally the R runtime crashes on the first use of REvaluate, and the following message is shown: “Crash in low-level RLink component or in R runtime. Please reinstall RLink via InstallR”. After using InstallR[] a second time, RLink seems to work fine.

the following then seems to get things working for me on Windows 10 with Mathematica 11.3:

Needs["RLink"]
InstallR["RHomeLocation" -> "c:\\Program Files\\R\\R-3.4.4"]
REvaluate["x = 6"]

(* REvaluate::crash: Crash in low-level RLink component or in R runtime.

Now all subsequent RLink` commands work.