How to install rgl in OS X 10.14 - r

I am running a vanilla copy of R 3.5.2:
> version
_
platform x86_64-apple-darwin18.2.0
arch x86_64
os darwin18.2.0
system x86_64, darwin18.2.0
status
major 3
minor 5.2
year 2018
month 12
day 20
svn rev 75870
language R
version.string R version 3.5.2 (2018-12-20)
nickname Eggshell Igloo
R is installed via Homebrew:
$ brew --version
Homebrew 1.9.2
Homebrew/homebrew-core (git revision de1ec; last commit 2019-01-15)
Homebrew/homebrew-cask (git revision 68a73e; last commit 2019-01-14)
I am trying to install the rgl package from within XQuartz 2.7.11 and the xterm application, and I get the following error:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/local/lib/R/3.5/site-library/rgl/libs/rgl.so':
dlopen(/usr/local/lib/R/3.5/site-library/rgl/libs/rgl.so, 6): Library not loaded: #rpath/libc++.1.dylib
Referenced from: /usr/local/lib/R/3.5/site-library/rgl/libs/rgl.so
Reason: image not found
Error: package or namespace load failed for 'rgl':
.onLoad failed in loadNamespace() for 'rgl', details:
call: NULL
error: Loading rgl's DLL failed.
On MacOS, rgl depends on XQuartz, which you can download from xquartz.org.
Here is a screenshot to confirm that I am attempting the install from within the XQuartz xterm application:
Are there any additional steps required to configure Mac OS X 10.14 and XQuartz 2.7.11, which allows installation of rgl?

Related

rJava on macOS with M2 processor

This question is similar to this one.
I'm pretty sure I have installed the correct R-4.2.2-arm64.pkg. Then, I don't understand why this error is appearing.
library(rJava)
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(jli, FALSE)
error: unable to load shared object '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib':
dlopen(/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib, 0x000A): tried: '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib' (no such file), '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
My setup
MacBook Air
Chip: M2
macOS: Ventura 13.0.1
R version 4.2.2 (2022-10-31) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)
Rstudio version: 2022.7.2.576 (Spotted Wakerobin)
Any help will be appreciated

Trouble running package "xlsx"

After installing R and RStudio on my new computer everything works fine, except the "xlsx" package. When trying to call it with library(xlsx) I get this error message:
Error: package or namespace load failed for ‘xlsx’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
The versioncommand produces the following output:
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 6.1
year 2019
month 07
day 05
svn rev 76782
language R
version.string R version 3.6.1 (2019-07-05)
nickname Action of the Toes
I see from similar questions that this problem might stem from the fact that the Java and the R versions don't correspond. But here, everything else works, and so far this seems to be the only package that produces this error message. I can't have more than one Java version installed at the time, can I? I have tried to reinstall the package, with the same result.
I have quite a lot of scripts where I have used the "xlsx" package, the synthax is different than the alternative package "readxl" and I would by far prefer to make the "xlsx" package work, rather than switching to "readxl". The "xlsx" package also comes with more options.
Any suggestions?

Can't load package xlsx after upgrading to Sierra

I recently updated to Sierra and it seems like I can't load packages that depends on rJava anymore.
For example:
library(xlsx)
Gives:
Loading required package: rJava
Loading required package: xlsxjars
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
Error : .onLoad failed in loadNamespace() for 'xlsx', details:
call: .jinit()
error: JNI_GetCreatedJavaVMs returned -1
Error: package or namespace load failed for ‘xlsx’
Here is my sessions info:
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12
And Java is updated to the latest version (8.111).
As far as I can understand from some similar posts the java directories is not configured correctly.
You can solve this with terminal commands that fix the wrongly configured directories and there are multiple posts that use this strategy. But this can be rather confusing.
A much easier strategy that worked for me is to use homebrew to install java. After installing Homebrew you can install java with the following commands
brew update
brew cask install java

ggplot2 sourcing error: X11 library is missing

I'm trying to load ggplot2 library for R.
1) I've installed ggplot2 by this command. It was installed with no errors
install.packages('ggplot2', dependencies = TRUE)
2) Then i'm trying to use
library(ggplot2)
and get an error
Error : .onLoad не удалось в loadNamespace() для 'tcltk', подробности:
вызов: fun(libname, pkgname) ошибка: X11 library is missing: install
XQuartz from xquartz.macosforge.org Ошибка: не удалась загрузка пакета
или пространства имен для ‘ggplot2’
3) Now i try to install XQuartz library by
install.packages("XQuartz")
and get this
Warning in install.packages : package ‘XQuartz’ is not available
(for R version 3.1.2)
My R version 3.1.2
OS X Yosemite 10.10.2
Can you help me in installing ggplot2 pls?
The OS update deleted the /usr/X11 and /usr/X11R6 symlinks. I had to just re-install XQuartz from macosforge which will setup the symlinks again.
I got the same error message about the missing library.
Nowadays, a lot of libraries can be installed with Homebrew. For this instance it would be:
brew cask install xquartz
Newer users of Homebrew may need this command:
brew install --cask xquartz
R opens graphics windows using the standard X11 library on Macs, which is no longer part of the standard MacOS. When you try running programs that open a graphics window, you will get a message: "Error in check_for_XQuartz(): X11 library is missing: install XQuartz from xquartz.macosforge.org" and it should work

Error rJava 64bit R&Eclipse

I have been trying to switch to 64-bit environment but i get stuck with rJava not working.
I have followed thread where people where having the same problem and their solution (JDK, JVM.DLL, environment variables etc..) but i am still stuck
Here is the error i get:
Loading required package: Rbbg
Loading required package: rJava
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'H:/R/R-2.15.2/library/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified path is invalid.
Failed with error: 'package 'rJava' could not be loaded'
Here is R.version
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 2
minor 15.2
year 2012
month 10
day 26
svn rev 61015
language R
version.string R version 2.15.2 (2012-10-26)
Thanks in advance
The problem because R can't find the jvm for the 64 architecture.
Normally if you have installed it you will get something like
C:\Program Files\Java\jre7\bin\server
Add this to your windows path and restart R.
Edit To ckeck if all things are right:
Type:
Sys.getenv()['PATH']
you get the environment variables inclusing the path for jvm.dll. If youd'ont have the jvm path here you need to add it using the usual Advanced System Settings method and restart your R console so this take effect.
Sys.getenv()['ProgramW6432']
You get C:\Program Files for the 64 archtitecture.

Resources