About "xlsx" package in R [duplicate] - r

This question already has answers here:
Problems when trying to load a package in R due to rJava
(10 answers)
Error loading xlsx library in R [duplicate]
(1 answer)
Error: package ‘rJava’ could not be loaded when installing xlsx
(1 answer)
Closed 2 years ago.
I installed package xlsx in R studio on Mac. It is the first time to install R studio on this computer. But I got an error when tried to install it:
> library("xlsx")
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Error: package or namespace load failed for ‘xlsx’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so
Reason: image not found
In addition: Warning message:
In system("/usr/libexec/java_home", intern = TRUE) :
running command '/usr/libexec/java_home' had status 1
I am not sure what wrong I am doing. Thank you for the help!

Related

error message trying to install homals package in R

I'm trying to install the Homals package - library(homals), but keep getting this error message:
library(homals)
Error : .onLoad failed in loadNamespace() for 'rgl', details: call:
dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared
object
'/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/libs/rgl.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/libs/rgl.so,
6): Library not loaded: /opt/X11/lib/libGLU.1.dylib Referenced from:
/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/libs/rgl.so
Reason: image not found Error: package or namespace load failed for
‘homals’
I have a couple of my colleagues to run the same code, the same thing happens. I have re-install R studio to the newest version.
install.packages("rgl")
install.packages("homals")
library(homals)
Any solutions for this? thank you.
I was able to successfully install on both Windows and Mac. I believe the root cause here is that you have R version 3.3 installed when you require at least v3.5.3 as per below:
library(homals)
Warning message:
package ‘homals’ was built under R version 3.5.3

I have installed package "xlsx" in my R, but when try to open the library "xlsx", it warned that the package load failed [duplicate]

This question already has answers here:
rJava install error "JAVA_HOME cannot be determined from the Registry"
(11 answers)
Problems when trying to load a package in R due to rJava
(10 answers)
Closed 3 years ago.
I have installed the xlsx package into my R, and I have verify that it is there. But when I try to open the library xlsx, it said that package or namespace load failed for xlsx.
This is a R version 3.6.0 and I am following a tutorial in https://www.tutorialspoint.com/r/r_excel_files.htm
> any(grepl("xlsx",installed.packages()))
[1] TRUE
> # Load the library into R workspace.
> library("xlsx")
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
According to the tutorial, the output should be
[1] TRUE
Loading required package: rJava
Loading required package: methods
Loading required package: xlsxjars

Java version and R version is the same still getting onLoadNamespce Error [duplicate]

This question already has answers here:
R, loading rJava error
(2 answers)
Closed 4 years ago.
library(rJava)
Still getting same error:
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object
I'm facing the same issue as you when I have installed JDK 9. All packages that requied java that stops working.
Downgrade to JDK 8 it will work.

R rJava Error on Mac when loading xlsx library [duplicate]

This question already has answers here:
rJava load error in RStudio/R after "upgrading" to OSX Yosemite
(18 answers)
Closed 5 years ago.
when I execute the following code on Mac, I got this
**> library(xlsx)**
Loading required package: rJava
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
Error: package ‘rJava’ could not be loaded
I saw some posts here that changes the directory of Java Home, but they are all in Windows system. I am wondering how can I fix this in a Mac environment?
Try this
If homebrew is not installed, install it from https://brew.sh/
Run this from terminal: brew cask install java
Reinstall rJava from R console
In general, and to avoid similar problems in the future, I suggest to follow my post to install R using homebrew http://pacha.hk/2017-07-12_r_and_python_via_homebrew.html
Doing that solves path problems and related stuff that can re-appear if later you want to use R database tools and related.

Can not load package tcltk in R [duplicate]

This question already has answers here:
Error ".onLoad failed in loadNamespace() for 'tcltk'"
(7 answers)
Closed 7 years ago.
I am trying to do multiple imputation in R and have installed Amelia and tried to open AmeliaView but it said require tcltk package. I proceeded to install tcltk but error message pop out as follows. Could someone help me?
> AmeliaView()
Loading required package: tcltk
Loading Tcl/Tk interface ... Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.12/Resources/library/tcltk/libs/i386/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.12/Resources/library/tcltk/libs/i386/tcltk.so, 10): Library not loaded: /usr/local/lib/libtcl8.5.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/2.12/Resources/library/tcltk/libs/i386/tcltk.so
Reason: image not found
Error in AmeliaView() : The package 'tcltk' is required
> require(tcltk2)
Loading required package: tcltk2
Loading required package: tcltk
Loading Tcl/Tk interface ... Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.12/Resources/library/tcltk/libs/i386/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.12/Resources/library/tcltk/libs/i386/tcltk.so, 10): Library not loaded: /usr/local/lib/libtcl8.5.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/2.12/Resources/library/tcltk/libs/i386/tcltk.so
Reason: image not found
Failed with error: ‘package 'tcltk' could not be loaded’
This might be useful for those having the same issue on Linux (long discussion, skip to the end to get the final solution):
http://r.789695.n4.nabble.com/Where-is-the-tcltk-package-td3434915.html
If your version of R > 3.0 then Tck/Tk 8.6.0 come bundles with it. You should be ok deleting it
See: http://cran.us.r-project.org/bin/macosx/tools/

Resources