0

Received this error message from R when using openxlsx package, not sure where to look.

Error in zip_internal(zipfile, files, recurse, compression_level, append = FALSE, : Some files do not exist

Does anyone have any suggestions? thanks.

The code is simple:

library(openxlsx)
df1 <- cars
write.xlsx(df1, file = 'cars.xlsx')
Ehsan Mohammadi
  • 1,168
  • 1
  • 15
  • 21
Xu Jason
  • 1
  • 3
  • I have the same problem. Refence to github isse: https://github.com/awalker89/openxlsx/issues/478 – Willem Jul 29 '19 at 07:42

1 Answers1

0

The error resolves itself if you add a TMP environment variable. As I suspected this is because the saveWorkbook function uses the function tempdir which creates a temporary directory and uses the TMP variable (among a list of other options) to do this (see documentation for more info).

The relevant lines of code are on line 223 here. Note that tempdir is not called directly, but through the function tempfile which uses tempdir() as default value for its tmpdir argument.

Related Github issue

Willem
  • 976
  • 9
  • 24