简体   繁体   中英

R Version 3.4.0, Unable to install xlsx

I'm trying to install 'xlsx' through install.packages('xlsx') and this shows me

 Warning in install.packages :`` cannot open URL 'https://cran.rstudio.com/bin/macosx/el- capitan/contrib/3.4/PACKAGES.rds': HTTP status was '404 Not Found' trying URL 'https://cran.rstudio.com/bin/macosx/el- capitan/contrib/3.4/xlsx_0.5.7.tgz' Content type 'application/x-gzip' length 401263 bytes (391 KB``) downloaded 391 KB The downloaded binary packages are in /var/folders/tt/2_by_ybs0tb3fd0_xv2v2xbw0000gn/T//Rtmpa3VNMs/downloaded_packages 

After some research, I found out that I needed to install rJava and it seemed fine. When I click xlsx and rJava through 'packages', it showed me

 library("xlsx", lib.loc="/Library/Frameworks/R.framework/Versions/3.4/Resources/library") 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.s>o Reason: image not found Error: package 'rJava' could not be loaded 

and this is for rJava

 library("rJava", >lib.loc="/Library/Frameworks/R.framework/Versions/3.4/Resources/library") 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.s>o Reason: image not found 

I was wondering what happened and want to know how to fix it. I am using a MacBook Air from 2015. Some people say 3.4.0 doesn't support xlxs or rJava yet. It would be so helpful if you tell me how to go through these issues step by step.

Take a look at the location here: R, Java, rJava and macOS adventures

You can find there description of how to deal with Java, R, rJava inside macOS. There is some mess, generally, there. You have to pay attention to few things like:

  • location of JDK,
  • making sure R points to proper libs,
  • making sure you are using Oracle's based JDK.

Eventually, you should get it running once setting all the stuff in place.

I don't post full description here as it's quite long. Also, pay attention to JDK settings that allow to run JNI based codes. You need to make sure that JDK has proper settings inside

`/usr/libexec/java_home`/../Info.plist

Lots of things to be done, but eventually, it should work :)

Have fun with R.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM