简体   繁体   English

在Rstudio中读取xlsx文件

[英]read xlsx files in Rstudio

I am taking the R programming class from Cousera, and while I was practising how to read in xlsx files using read.xlsx, I encountered the following error message: 我正在从Cousera学习R编程类,当我练习如何使用read.xlsx读取xlsx文件时,我遇到以下错误消息:

dat<- read.xlsx(file="./data/nga.xlsx", sheetIndex=1)

Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, : java.util.zip.ZipException: oversubscribed literal/length tree .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,错误.jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :java.util.zip.ZipException:oversubscribed literal / length tree

R version 3.2.1, R studio version 3.2.1, platform windows7 64bit. R版本3.2.1,R studio版本3.2.1,平台windows7 64bit。 Can anyone give a hint what this message means and how to work around it? 任何人都可以暗示这条消息的含义以及如何解决这个问题?

Thanks, Gezimao 谢谢,Gezimao

您下载的文件已损坏,因此请使用参数'mode =“wb”'再次下载该文件。

试试这个包https://github.com/hadley/readxl

read_excel("my-new-spreadsheet.xlsx")

Download and install this java: http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html 下载并安装此java: http//www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html

then run your code and it should work. 然后运行你的代码,它应该工作。 If it does check best answer :) 如果它确实检查最佳答案:)

I had the same problem. 我有同样的问题。 The .xlsx file may be 'read only'. .xlsx文件可能是“只读”。 Try 'Save As' to a new file from Excel and try read.xlsx again. 从Excel中尝试“另存为”新文件,然后再次尝试read.xlsx。

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

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