I found zip
and the RCompression
package but can they do:
write.zip(x, file = "foo.zip")
as you'd with write.csv
?
I'm also aware of gzfile
.
To zip files in R, use the zip() function. The zipped file is stored inside the current directory unless a different path is specified in the zip() function argument. The zip() method creates a new ZIP archive, and it overwrites the output file if it exists.
Hold down [Ctrl] on your keyboard > Click on each file you wish to combine into a zipped file. Right-click and select "Send To" > Choose "Compressed (Zipped) Folder."
The zip = "C:\\Program Files\\7-Zip\\7Z" argument tells R what program to use perform the compression. In this case, I pointed it at 7Z, the command line version of 7Zip, but you can use other command line programs by changing this to point to a different program.
That makes the transfer of multiple files an onerous and time-consuming task. Because transferring a single file is always faster than multiple files, the ZIP format is a handy tool for improving overall file transfer turnaround time through fast file consolidation.
It's possible using gzip.
write.csv(mtcars, file=gzfile("mtcars.csv.gz"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With