thisisnic commented on a change in pull request #91: URL: https://github.com/apache/arrow-cookbook/pull/91#discussion_r738220211
########## File path: r/content/reading_and_writing_data.Rmd ########## @@ -359,3 +358,121 @@ unlink("my_table.parquet") unlink("dist_time.parquet") unlink("airquality_partitioned", recursive = TRUE) ``` + +## Write compressed data + +You want to save a file, compressed with a specified compression algorithm. + +### Solution + +```{r, parquet_gzip} +# Create a temporary directory +td <- tempfile() +dir.create(td) + +# Write data compressed with the gzip algorithm +write_parquet(iris, file.path(td, "iris.parquet"), compression = "gzip") +``` + +```{r, test_parquet_gzip, opts.label = "test"} +test_that("parquet_gzip", { + file.exists(file.path(td, "iris.parquet")) +}) +``` + +### Discussion + +You can also supply the `compression` argument to `write_dataset()`, as long as Review comment: Good point, have extended the text in the "see also" section to reference this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org