-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
export several files to zip file (#203) #346
Conversation
@chainsawriot please have a look if the logic I used makes sense to you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two comments
R/export_list.R
Outdated
@@ -76,14 +78,20 @@ function( | |||
} | |||
outfiles <- file | |||
} | |||
|
|||
if (is.na(archive_format$compress) & archive_format$file != "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Use
&&
(gp) -
This won't write to new directory:
## if archivea is not created
export_list(mylist, file = paste0("file_", 1:3, ".xlsx"), archive = "archivea")
Maybe check and create it first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I suggest adding normalizePath
to outfiles
and archive
. Windows cannot handle "~/" without normalizePath
outfiles <- base::normalizePath(outfiles)
archive <- base::normalizePath(archive) ## if it is not ""
@schochastics I checked and it works fine, except the case of writing to new directory. |
@chainsawriot Thanks will address the comments
Yes forgot to ask you about that. export does not create a new dir if it doesn't exist R> export(mtcars,"i_dont_exist/test.csv")
Error in data.table::fwrite(x, file = file, sep = sep, row.names = row.names, :
No such file or directory: 'i_dont_exist/test.csv'. Unable to create new file for writing (it does not exist already). Do you have permission to write here, is there space on the disk and does the path exist? I can make |
@schochastics Thanks for finding this out. I will open a new issue and fix that. |
@chainsawriot actually since export_list calls export for the default case, I will only implement the "new dir" feature for the archive |
@schochastics OK, just leave it like that and I will fix #347 I think the expected output for |
@schochastics Great! Thank you! |
No description provided.