在线阅读 xlsx - sheet in R

read in online xlsx - sheet in R

我无法阅读此 xlsx 文件并使用 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

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

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

如果我运行这个:

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。