0

I have been using the rio package to import / export data in r

currently, I cannot export to excel. Every time I try to export a file in .xlsx, it does not give any error messages but the generated file is always a small 22 bytes and does not open.

I tried to export using openxlsx package which also produces the same corrupted file.

Any thoughts what could be wrong?

This is an example code I tried:

xx = data.frame(x=c(1,2,3,4,5), y=c(0,8,9,7,6))
rio::export(xx, "xx.xlsx")

 library(openxlsx)
 write.xlsx(xx, file = "xx.xlsx")

and this is my session info:

R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
zx8754
  • 52,746
  • 12
  • 114
  • 209
Bahi8482
  • 489
  • 5
  • 15
  • 2
    `I tried to export using openxlsx package which generates the same error`. What is the error? – Ronak Shah Feb 24 '21 at 04:14
  • 1
    I cannot reproduce the error, the posted code works as expected. The output files were 6.2 KB, vote to close as not reproducible. – Rui Barradas Feb 24 '21 at 04:24
  • @RonakShah I meant it also generates a corrupted file. I changed the question to clarify that. thank you. – Bahi8482 Feb 24 '21 at 04:37
  • I can't reproduce this either. – Ronak Shah Feb 24 '21 at 04:39
  • @RuiBarradas besides voting to close, was wondering if someone has any suggestions on where the problem can be. a dependency package? java? etc... – Bahi8482 Feb 24 '21 at 04:39
  • @RonakShah thanks for trying. I re installed rio and openxlsx packages but still without a resolution. – Bahi8482 Feb 24 '21 at 04:40
  • Package openxls does not depend on Java, it uses Rcpp. The error must be somewhere else. Try reinstalling Rcpp? – Rui Barradas Feb 24 '21 at 04:43
  • @RuiBarradas thanks for the suggestion. I also tried that. but the generated file is still corrupted. I am using a work laptop without admin rights but do not believe this is a reason. – Bahi8482 Feb 24 '21 at 04:45
  • I'm on Ubuntu 20.04 and cannot think of anything relevant to WIndows, I'll retract my close vote. Good luck. – Rui Barradas Feb 24 '21 at 05:17
  • Same with me. the code works as expected the output file 6.1KB. – TarJae Feb 24 '21 at 05:27

0 Answers0