使用R包“ repmis”从Dropbox读取xlsx文件时出错 [英] Error reading an xlsx file from Dropbox using the R package 'repmis'

查看:105
本文介绍了使用R包“ repmis”从Dropbox读取xlsx文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够将xlsx工作簿中的工作表读入R,以便在Shiny应用程序中使用。 (我知道它应该是一个csv文件,但是很遗憾,这不是我的决定...)。(编辑添加:我需要阅读的文件位于保管箱上) repmis程序包。我尝试过的代码很简单:

  library('repmis')
library('xlsx')
lnk<- https://www.dropbox.com/s/pzyt86pguko3xg6/TestBook.xlsx?dl=0
my_data< -source_XlsxData(lnk,sheet = MainData,startRow = 1)

不幸的是,我收到以下错误消息:

  .jcall( RJavaTools, Ljava / lang / Object;, invokeMethod,cl,中的错误:
java.lang.IllegalArgumentException:您的InputStream既不是OLE2流,也不是OOXML流

我不知道这是什么意思...:|

解决方案

我认为最近的更新删除了从R内部读取存储在Dropbox上的数据文件的功能。我将寻求确认,并且否则删除我的评论。



来源:几个月前我自己遇到了同一问题



更新:确认github软件包中已放弃支持< a href = https://github.com/christophergandrud/repmis/commit/f85469f38c6f4e4a5735ecc888b4263b969d4e22 rel = nofollow> https://github.com/christophergandrud/repmis/commit/f85469f38c6f4e4a5735ecc888b426b> b $ b

I need to be able to read a sheet from an xlsx workbook into R for use in a Shiny app. (I know it should be a csv file, but that is unfortunately not my decision...).(Edited to add: The file I need to read is on dropbox) I am trying to use the repmis package. The code I have tried is simply:

library('repmis')
library('xlsx')
lnk<-"https://www.dropbox.com/s/pzyt86pguko3xg6/TestBook.xlsx?dl=0"
my_data<-source_XlsxData(lnk, sheet="MainData", startRow=1)

Unfortunately I get the following error message:

Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  :
java.lang.IllegalArgumentException: Your InputStream was neither an OLE2 stream, nor an OOXML stream

I have no idea what it means... :|

解决方案

I think a recent update removed the ability to read data files stored on Dropbox from within R. I will go look for confirmation, and delete my comment otherwise.

Source: Ran into the same issue myself a couple of months ago

UPDATE: Confirmation of dropped support within the github package https://github.com/christophergandrud/repmis/commit/f85469f38c6f4e4a5735ecc888b4263b969d4e22

这篇关于使用R包“ repmis”从Dropbox读取xlsx文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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