Mlr / FSelector installation error ... Java related
I beat my head about this for a day or two. Trying to run some analysis via "mlr" and I am stuck on a package installation error. Specifically, I am trying to run:
im_feat <- generateFilterValuesData(trainTask, method = c("information.gain","chi.squared"))
My initial run of this code produced the following error:
Error in loadNamespace(name) : there is no package called βFSelectorβ
The smart guy that I am, I decided to install FSelector. However, when I did it, it would bomb when it tried to load the "RWeka" dependency. Specifically, I got the following error:
Error : .onLoad failed in loadNamespace() for 'RWeka', details:
call: .jnew("weka.core.WekaPackageManager")
error: java.lang.UnsupportedClassVersionError:weka/core/WekaPackageManager : Unsupported major.minor version 51.0
Error: loading failed
Execution halted
I've been digging this for a day or so. Here's what I've already done:
- Updated java ... runtime and DK
- Make sure R and java are 64 bit
-
Make sure JAVA_HOME is pointing to the correct location like this:
Sys.setenv(JAVA_HOME='~/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home')
Any ideas are sincerely appreciated!
source to share
Never got a response, but I was able to fix it. For the sake of completeness, I figured I would post what worked for me in case anyone else has this issue and finds this question.
Step 1: terminal
$ sudo R CMD javareconf
Step 2: Back to RStudio
install.packages("rJava",type = "source")
install.packages("RWeka")
FSelector and all related packages have been downloaded and are working after that.
source to share