jorisvandenbossche commented on a change in pull request #91:
URL: https://github.com/apache/arrow-cookbook/pull/91#discussion_r738361253
##########
File path: r/content/reading_and_writing_data.Rmd
##########
@@ -359,3 +358,123 @@ 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")
Review comment:
I am going to give the same comment as on the PR for the Python version
.. but, `write_parquet` already compresses by default. So I would personally at
least mention that more prominently (instead of the "see also" quite a bit
below).
In addition, this is showing the code snippet `write_parquet(...,
compression= "gzip")` which people might start copy pasting if they want
compression. I personally don't know much about the different compression
variants, so I don't know if this is actually a good choice to show.
(in general, we probably want people to just do `write_parquet(table, file)`
without an actual compression specified, except if you know what you are doing
and have a reason to choose a specific compression)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]