R xlsx包错误 [英] R xlsx package error

查看:145
本文介绍了R xlsx包错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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)?


推荐答案

我从使用互联网下载的文件出现此问题R命令行,用于在线课程。发现显然下载模式需要正确设置为write-binary(wb),因为xlsx基本上是一个二进制文件(zip)。谁知道?

I had this problem with a file downloaded from the internet using R command line, for an online course. Found that apparently the download mode needs to be set properly as write-binary (wb) since xlsx is basically a binary file (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')

这篇关于R xlsx包错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆