How to directly perform write.csv in R into tar.gz format?

前端 未结 1 1599
攒了一身酷
攒了一身酷 2020-12-09 09:57

I have a big data.frame that I want to write into a compressed CSV file. Is there any way to directly write the data into a CSV.TAR.GZ compressed file instead of performing

相关标签:
1条回答
  • 2020-12-09 10:38

    Use gzfile (or bzfile for bzip2 archiving, or xzfile for xz archiving).

    write.csv(mtcars, file=gzfile("mtcars.csv.gz"))
    

    PS. If you only have one data frame, surely you don't need tar.

    0 讨论(0)
提交回复
热议问题