R directly saves data as a zip file

I found the zip and RCompression package, but can they do:

 write.zip(x, file = "foo.zip") 

how would you do with write.csv ?

I also know gzfile .

+10
r compression zip
source share
2 answers

Use of gzip is possible.

 write.csv(mtcars, file=gzfile("mtcars.csv.gz")) 
+9
source share

This can be done quite easily using the readr and gzip functions.

 write_tsv(mtcars, file.path(dir, "mtcars.tsv.gz")) write_csv(mtcars, file.path(dir, "mtcars.csv.gz")) 
0
source share

All Articles