MaVe
MaVe

Reputation: 219

Error when exporting R data frame using openxlsx ("Error in zipr")

Usually I'm using the openxlsx package and the write.xlsx function when exporting R data frames into .xlsx-files. Since yesterday - probably after I was using the package XLConnect - something got messed up and the write.xlsx function doesn't work anymore. This is the error I get:

Error in zipr(zipfile = tmpFile, include_directories = FALSE, files = list.files(path = tmpDir, : unused argument (include_directories = FALSE)

Unfortunately, I don't understand what this error means. Thanks for any helpful advice.

Edit: The function works when I use an older openxlsx version (4.1.0).

Upvotes: 1

Views: 3068

Answers (2)

meono
meono

Reputation: 88

I was getting the same error.

I think the problem is with dependencies of openxlsx. There is a "zipR" package that might be picked up when you install openxlsx, while the actual dependency is zip package:

I installed "zip" along with openxlsx and I don't get the error anymore.

Upvotes: 1

Zhiqiang Wang
Zhiqiang Wang

Reputation: 6759

I do not really understand the error message here. My computer does not allow me to save files to "c:/". So, if remove "c:/" part, it works fine, to save the file to the current working directory.

library(openxlsx)
df <- data.frame('x' = c(1,2,3),
                 'y' = c(3,2,1))
openxlsx::write.xlsx(df, "test.xlsx")

You would also try another package: writexl

writexl::write_xlsx(df, "text5.xlsx")`

This works on my machine.

Upvotes: 0

Related Questions