0

I am using xlsx::addDataFrame to write 450,000 rows of a data.frame to a sheet and get the "Invalid row number" error. Can anybody tell me how to fix it? Or is there anyway to bypass this difficulty? Any command is appreciated. Thanks a lot.

addDataFrame(x,col.names=TRUE, row.names=FALSE, startRow=5, + startColumn=1, sheet=sheet2) Error in .jcall("RJavaTools", "Ljava/lang/Object;", "newInstance", .jfindClass(class), : java.lang.IllegalArgumentException: Invalid row number (65536) outside allowable range (0..65535)

  • 1
    The error message seems pretty clear, there is a 4 byte limit to the row number range. Perhaps you could shrink your data set? – Tim Biegeleisen Oct 18 '16 at 16:54
  • I should be more specific for the software I am using. I am using the R xlsx (0.5.7) package on R 3.1.3. Thanks. – ChaoJenWong Oct 18 '16 at 16:55
  • Hi, Tim, Thanks for your response. Unfortunately I cannot shrink my dataset. Each row represents an value on the human genome. That's why it is big. – ChaoJenWong Oct 18 '16 at 16:58
  • Have you tried `write.xlsx`? You'll have to start on row 1, column 1, but there might not be a byte limit. – jmartindill Oct 18 '16 at 17:00
  • Hi, jmartindill, I am trying it now. It have been 45 mins and xlsx::write.xlsx is still working on it. It seems to work. Really appreciated. – ChaoJenWong Oct 18 '16 at 17:43
  • Hi, jmartindill, the xlsx::write.xlsx function bumped me out the R workspace after few hours of working. So I guess there is still a byte limit, from java maybe? Now I am using openxlsx that does not depend on java and I will see how it goes. Thank you, Tim and jmartindill, for your prompt responses. Very appreciated. – ChaoJenWong Oct 19 '16 at 18:42

0 Answers0