So it looks like I got RLink working on my Windows machine:
Needs["RLink`"]
RLinkResourcesInstall[]
RSet["myVar", 10]
10
REvaluate["{
a <- 1;
b <- 2;
c <- 3;
c(a,b,c)
}"]
{1., 2., 3.}
However if I try to install quantmod
or any package for that matter, this happens:
REvaluate["install.packages(\"quantmod\")"]
REvaluate::rerr: Failed to retrieve the value for variable or piece of code install.packages("quantmod").
The following R error was encountered: Error in gzfile(file, mode) : cannot open the connection
Any help to fix this and get my packages working via RLink would be greatly appreciated.
Update: Still not working
I downloaded R version 4.1.3 from https://cran.r-project.org/ and set it to my C:\ Program Files directory.
I then ran
InstallR["RHomeLocation" -> "C:\\Program Files\\R\\R-4.1.3"]
And got this error message
InstallR::nxctlib: Warning: no JRI library found for R version
4.1.3. Will attempt to use the library for version 4.1.2. In case
of failure, build JRI library from within R console (happens
automatically when installing rJava Rpackage, see RLink
documentation for using RLink with external R distributions, for
more details), and point InstallR[] to it by passing the directory
containing JRI library (typically R-home-
directory/library/rJava/jri), as a value for "NativeLibLocation"
option.
I then installed what I believed to be rJave Rpackage from here http://www.rforge.net/rJava/files/
and then ran
InstallR["RHomeLocation" -> "C:\\Program Files\\R\\R-4.1.3",
"NativeLibLocation" -> "C:\\Program Files\\rJava\\jri"]
and got this error message
InstallR::nonlib: The value of NativeLibLocation option should
point to an existing directory containing a valid native JRI
library. No valid native JRI library found at location C:\Program
Files\rJava\jri
I never coded in Java, I barely know what Java is. Can anyone tell me the simplest way to get R fully working in Mathematica so I can run some timeseries forecasts using it.
If I go and try REvaluate["install.packages(\"quantmod\")"]
It will just evaluate indefinitely without ever resolving or posting an error message. It is the same for all packages.
Thanks
RLinkResourcesInstall[]
does not work for me, and I install RLink withInstallR["RHomeLocation" -> "/Library/Frameworks/R.framework/Resources", "NativeLibLocation" -> "/Library/Frameworks/R.framework/Resources/Library/rJava/JRI"]
. I have the latest version of R for ARM (4.1.3). $\endgroup$InstallR["RHomeLocation" -> "C:\\Program Files\\R\\R-4.1.1"]
on my Windows 10 machine (Mathematica 13.0.1.0) allowsREvaluate["install.packages(\"quantmod\")"]
to work. $\endgroup$