在线阅读 xlsx - R 中的表格 [英] read in online xlsx - sheet in R

查看:55
本文介绍了在线阅读 xlsx - R 中的表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法阅读此 xlsx 文件并使用 sheet=2(数据")"http://www3.weforum.org/docs/gcr/2015-2016/GCI_Dataset_2006-2015.xlsx"

I have Trouble reading in this xlsx file and working with sheet=2 ( "Data") "http://www3.weforum.org/docs/gcr/2015-2016/GCI_Dataset_2006-2015.xlsx"

我做了什么:

library(readxl)
library(XLConnect)
library("openxlsx")

temp = tempfile(fileext = ".xlsx")
dataURL <- "http://www3.weforum.org/docs/gcr/2015-2016/GCI_Dataset_2006-2015.xlsx"
download.file(dataURL, destfile=temp, mode='wb')
file<- read.xlsx(temp, sheet= 2)

我得到以下信息:

Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  :  java.lang.OutOfMemoryError: GC overhead limit exceeded

有人可以帮忙吗?谢谢:)

Could someone help? Thnx :)

推荐答案

我似乎对这个特定文件使用 readxl 没有问题.使用同一个包,我确实遇到了由我无法控制的其他系统创建的特定电子表格的问题(开发人员知道这一点).

I don't seem to have issues using readxl for this specific file. With the same package I do have issues with specific spreadsheets created by other systems I can't control (the dev is aware of that).

如果我运行这个:

temp = tempfile(fileext = ".xlsx")
dataURL <- "http://www3.weforum.org/docs/gcr/2015-2016/GCI_Dataset_2006-2015.xlsx"
download.file(dataURL, destfile=temp, mode='wb')

test <- readxl::read_excel(temp, sheet =2)
head(test)

我得到以下输出:

# A tibble: 6 × 159
                                      `The Global Competitiveness Index Historical Dataset © 2005-2015 World Economic Forum `
                                                                                                                        <chr>
1 IMPORTANT The storage on any data retrieval system and the commercial use of the present data set, or portions of it, is st
2                                                                                                                   Placement
3                                                                                                                   Placement
4                                                                                                                           1
5                                                                                                                           1
6                                                                                                                           1
# ... with 158 more variables: X__1 <chr>, X__2 <chr>, X__3 <chr>, X__4 <chr>, X__5 <chr>, X__6 <chr>, X__7 <chr>,
#   X__8 <chr>, X__9 <chr>, X__10 <chr>, X__11 <chr>, X__12 <chr>, X__13 <chr>, X__14 <chr>, X__15 <chr>, X__16 <chr>,
#   X__17 <chr>, X__18 <chr>, X__19 <chr>, X__20 <chr>, X__21 <chr>, X__22 <chr>, X__23 <chr>, X__24 <chr>, X__25 <chr>,
#   X__26 <chr>, X__27 <chr>, X__28 <chr>, X__29 <chr>, X__30 <chr>, X__31 <chr>, X__32 <chr>, X__33 <chr>, X__34 <chr>,
#   X__35 <chr>, X__36 <chr>, X__37 <chr>, X__38 <chr>, X__39 <chr>, X__40 <chr>, X__41 <chr>, X__42 <chr>, X__43 <chr>,
#   X__44 <chr>, X__45 <chr>, X__46 <chr>, X__47 <chr>, X__48 <chr>, X__49 <chr>, X__50 <chr>, X__51 <chr>, X__52 <chr>,
#   X__53 <chr>, X__54 <chr>, X__55 <chr>, X__56 <chr>, X__57 <chr>, X__58 <chr>, X__59 <chr>, X__60 <chr>, X__61 <chr>,
#   X__62 <chr>, X__63 <chr>, X__64 <chr>, X__65 <chr>, X__66 <chr>, X__67 <chr>, X__68 <chr>, X__69 <chr>, X__70 <chr>,
#   X__71 <chr>, X__72 <chr>, X__73 <chr>, X__74 <chr>, X__75 <chr>, X__76 <chr>, X__77 <chr>, X__78 <chr>, X__79 <chr>,
#   X__80 <chr>, X__81 <chr>, X__82 <chr>, X__83 <chr>, X__84 <chr>, X__85 <chr>, X__86 <chr>, X__87 <chr>, X__88 <chr>,
#   X__89 <chr>, X__90 <chr>, X__91 <chr>, X__92 <chr>, X__93 <chr>, X__94 <chr>, X__95 <chr>, X__96 <chr>, X__97 <chr>,
#   X__98 <chr>, X__99 <chr>, X__100 <chr>, ...

注意:我使用的是 github 0.1.1.9000 中的当前版本,而不是 CRAN 0.1.1.

NOTE: I am using the current version from github 0.1.1.9000 and not the CRAN 0.1.1.

这篇关于在线阅读 xlsx - R 中的表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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