Cannot open the file after writing xlsx file using R openxlsx package

人走茶凉 提交于 2020-01-04 03:50:34

问题


At first, I tried to read and write xlsx files in R (while comparing the output between the xlsx and openxlsx packages).

I work on mac os.

It worked well to read xlsx files using the read.xlsx() from both packages. However, when it comes to writing a new file, only the xlsx::write.xlsx() worked.

To be more exact, the openxlsx::write.xlsx() command gave no error, and an xlsx file was successfully saved, but when I tried to open the file using Numbers (by double clicking on the file in the folder), an error message popped up telling me the file cannot be opened.

I tried different data frames, but the results remained the same. To show an example, please refer to the following line which I took directly from R help page. It should work but does not work for me.

write.xlsx(iris, file = "writeXLSX1.xlsx", colNames = TRUE, borders = "columns")

Anyone tell me what the problem is? I tried to google for old threads but it seems no one is discussing this problem. I know in many similar threads people suggested changing packages, okay...before that, can you tell me what the limitations of openxlsx are?

来源:https://stackoverflow.com/questions/44479997/cannot-open-the-file-after-writing-xlsx-file-using-r-openxlsx-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!