1

I can't seem to find a solution for this error:

> install.packages("devtools")
Installing package into ‘C:/Users/rawlingsD/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘memoise’, ‘git2r’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/memoise_1.1.0.zip'
Content type 'application/zip' length 29955 bytes (29 KB)
downloaded 29 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/git2r_0.21.0.zip'
Content type 'application/zip' length 3029324 bytes (2.9 MB)
downloaded 2.9 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/devtools_1.13.5.zip'
Content type 'application/zip' length 443954 bytes (433 KB)
downloaded 433 KB

package ‘memoise’ successfully unpacked and MD5 sums checked
package ‘git2r’ successfully unpacked and MD5 sums checked
package ‘devtools’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\rawlingsD\AppData\Local\Temp\Rtmpag2PO3\downloaded_packages
> devtools::install_github("kassambara/r2excel")
Downloading GitHub repo kassambara/r2excel@master
from URL https://api.github.com/repos/kassambara/r2excel/zipball/master
Installing r2excel
"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  "C:/Users/rawlingsD/AppData/Local/Temp/Rtmpag2PO3/devtools232469f6118a/kassambara-r2excel-4144fc5"  \
  --library="C:/Users/rawlingsD/Documents/R/win-library/3.4" --install-tests 

* installing *source* package 'r2excel' ...
** R
** preparing package for lazy loading
Error: package or namespace load failed for 'rJava':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: JAVA_HOME cannot be determined from the Registry
Error : package 'rJava' could not be loaded
ERROR: lazy loading failed for package 'r2excel'
* removing 'C:/Users/rawlingsD/Documents/R/win-library/3.4/r2excel'
In R CMD INSTALL

I have tried loading rJava seperately and this seems to be causing the issue, I have installed from a tar.gz file from rStudio as well as directly from the CRAN, however, neither have worked unfortuantely!

Thank you in advance for your help!

Still not resolved after redownloading Java x64, and trialling the line:

Sys.setenv(JAVA_HOME="C://Program Files//Java//jre1.8.0_161")

These were suggestions on another question, I am using Windows 10 and have the error below:

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 'C:/Users/rawlingsD/Documents/R/win-library/3.4/rJava/libs/i386/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

Thanks again for any help

Daniel Rawlings
  • 183
  • 1
  • 1
  • 8
  • 2
    See https://stackoverflow.com/questions/23209152/cannot-install-libraryxlsx-in-r-and-look-for-an-alternative?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – De Novo Mar 26 '18 at 19:27
  • 2
    May I suggest using the `openxlsx` package instead. It doesn't depend on `rJava`. – De Novo Mar 26 '18 at 19:29
  • Possible duplicate of [Cannot install library(xlsx) in R and look for an alternative](https://stackoverflow.com/questions/23209152/cannot-install-libraryxlsx-in-r-and-look-for-an-alternative) – De Novo Mar 26 '18 at 19:30

1 Answers1

0

The issue is more likely to be 32bit vs 64bit java installed in your computer. Uninstall java and install specific bit version (64 bit is better). Then install xlsx, rJava etc.

JeanVuda
  • 1,738
  • 14
  • 29