Is there any updates regarding installing CRAN packages via RLink in Mathematica 10 on Mac OS X? Or are we still stuck with the base R package and that's it?
I was able to point to my R distribution using this answer but using external packages led to errors.
Here is my code:
Needs["RLink`"]
SetEnvironment[
"DYLD_LIBRARY_PATH" ->
"/Library/Frameworks/R.Framework/Resources/lib"];
InstallR["RHomeLocation" ->
"/Library/Frameworks/R.Framework/Resources"];
REvaluate["R.version.string"]
REvaluate["library(GA)"]
REvaluate["f <- function(x) abs(x)+cos(x)
fitness <- function(x) -f(x)
ga(type='real-valued',fitness=fitness,min=-20,max=20)
summary(GA)"]
Out[15]= $Failed
and the error message:
REvaluate::rerr: Failed to retrieve the value for variable or piece of code f<- function(x) abs(x)+cos(x)
fitness <- function(x) -f(x)
ga(type='real-valued',fitness=fitness,min=-5,max=5)
summary(GA). The following R error was encountered: Error in typeof(myRandomVar123456740025) :
object 'myRandomVar123456740025' not found >>