1

我想从这样的大 excel 文件中读取数据:

从第五列,从第一行直到 140,但只有 1,3,5,7,.....139(只有 70 个值):

wb <- loadWorkbook("D:\\MA\\excel_mix_meiningen.xlsx")
dat <-readWorksheet(wb, sheet=getSheets(wb)[1], startRow=1, endRow=139, startCol=5, endCol=5)
odds <- function(x) {seq(1, length(x), 2)}
odds(unlist(dat))

但我收到此错误:

Error: OutOfMemoryError (Java): Java heap space

还有其他方法可以完成这项工作吗?

4

1 回答 1

1

The vignette on XlConnect suggests

options(java.parameters = "-Xmx2048m")

before loading the XlConnect package.

EDIT: You could try to reduce the size of the xlsx, maybe delete unneeded columns. You could save the sheet as CSV. You could use RODBC, as @Ananta suggested.

于 2013-11-04T14:45:17.910 回答