Message Boards Message Boards

0
|
354 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

REvaluate fails to load R package

I was able to get InstallR to execute on Mathematica 14.0 and link to R 4.1.1 (curiously, I could not get it to interface with a more recent version of R).

However, when I attempt to execute REvaluate, I get the error messages e.g. Error: package 'methods' could not be loaded

Even though library/methods and the other packages that REvaluate throws the error for are installed and can be loaded while in R. The details of the error are rather generic, but perhaps someone has encountered a similar problem and knows how to fix it, i.e. I load to libraries that have other libraries such as methods as dependencies,

REvaluate["{library(glmnet);library(MASS)}"]

and the resulting error is:

Error: package or namespace load failed for ‘methods’ in dyn.load(file, DLLpath = DLLpath, ...):unable to load shared object '/opt/R-4.1.1/library/methods/libs/methods.so':/opt/R-4.1.1/library/methods/libs/methods.so: undefined symbol: Rf_allocS4Object Error: package ‘methods’ could not be loaded*

as noted, libs/methods/ does exist. I assume that methods.so is a file that is being created to link to the library, which suggests that something fails when Mathematica attempts to do so.

POSTED BY: Max Shpak
2 Replies

Thank you for the information. Unfortunately, InstallR seems to be directed toward the "default" R (4.3.3) that's installed on the server, i.e. the version that opens if one types "R" in the command terminal. It continues to do so even though I direct InstallR to the path for R 4.1.1, and I can't figure out how to circumvent this.

POSTED BY: Max Shpak
Posted 27 days ago

You don't mention the steps you followed when using InstallR, but when I followed the documentation in RLink/tutorial/ConfigureExternalRInstallation, I was able to load already installed libraries.

I used the following for an older version of R:

Needs["RLink`"]

InstallR[
 "RHomeLocation" ->  "C:\\Program Files\\R\\R-4.1.2",
 "RVersion" -> "4.1.2",
 "JRINativeLibraryLocation" -> 
  "C:/Users/xxxx/Documents/R/win-library/4.1/rJava/jri/x64"
 ]
POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract