我找到zip了RCompression包裹,但他们能做到吗:
write.zip(x, file = "foo.zip")
和你一样write.csv?
我也知道gzfile。
我找到zip了RCompression包裹,但他们能做到吗:
write.zip(x, file = "foo.zip")
和你一样write.csv?
我也知道gzfile。
可以使用 gzip。
write.csv(mtcars, file=gzfile("mtcars.csv.gz"))
这可以使用 readr 函数和 gzip 轻松完成。
library(readr)
write_tsv(mtcars, file.path(dir, "mtcars.tsv.gz"))
write_csv(mtcars, file.path(dir, "mtcars.csv.gz"))
从文档中,?write_csv:
write_*()如果给出适当的扩展名,这些函数将自动压缩输出。目前支持三种扩展:.gzgzip 压缩、.bz2bzip2 压缩和.xzlzma 压缩。有关更多信息,请参阅示例。