简体   繁体   English

R xlsx包错误

[英]R xlsx package error

Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  : 
  java.util.zip.ZipException: invalid code -- missing end-of-block

Does anyone have this error when you try to use 当您尝试使用时,是否有任何人有此错误

dat <- read.xlsx("data.xlsx", sheetIndex=1, colIndex=colIndex, rowIndex=rowIndex)?

I had this problem with a file downloaded from the internet using R command line, for an online course. 我有一个使用R命令行从互联网上下载的文件的问题,用于在线课程。 Found that apparently the download mode needs to be set properly as write-binary (wb) since xlsx is basically a binary file (zip). 发现显然下载模式需要正确设置为write-binary(wb),因为xlsx基本上是一个二进制文件(zip)。 Who knew? 谁知道?

If that's what you did too, re-download the file with the mode set properly; 如果这也是你所做的,请在模式设置正确的情况下重新下载文件; like: 喜欢:

download.file(fileUrl, destfile='./data/sample.xlsx', mode='wb')

The version of java you have installed is likely incompatible with the xslx package. 您安装的Java版本可能与xslx软件包不兼容。 Try replacing your default java with the 64 bit version: https://www.java.com/en/download/faq/java_win64bit.xml . 尝试使用64位版本替换默认java: https//www.java.com/en/download/faq/java_win64bit.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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