Read.xlsx () throws an error in R
I have installed xlsx
dependent packages as well. Also I downloaded 64 bit Java required to install the rjava dependency package. Now when I try to use read.xlsx
, I get the following error. After installing 64-bit Java, I can successfully download the package, but on startupread.xlsx
> library(xlsx)
Loading required package: rJava
Loading required package: xlsxjars
> read.xlsx("ngas.xlsx",sheetIndex = 1)
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.util.zip.ZipException: invalid code -- missing end-of-block
I was getting the same error. As xlsx mode is binary by default. So if you add mode = 'wb' it might do the trick.
download.file(URL="", destfile="",mode='wb')
Check that your downloaded xlsx file is intact by opening it with excel. I had the same problem and found out that the downloaded file was corrupted. I manually downloaded using the link provided on the quiz page, did not use R to download.