Writes the contents of an R data frame into a Parquet file.
Usage
write_parquet(
x,
file,
compression = c("snappy", "gzip", "zstd", "uncompressed"),
metadata = NULL,
options = parquet_options()
)
Arguments
- x
Data frame to write.
- file
Path to the output file. If this is the string
":raw:"
, then the data frame is written to a memory buffer, and the memory buffer is returned as a raw vector.- compression
Compression algorithm to use. Currently
"snappy"
(the default),"gzip"
,"zstd"
, and"uncompressed"
are supported.- metadata
Additional key-value metadata to add to the file. This must be a named character vector, or a data frame with columns character columns called
key
andvalue
.- options
Nanoparquet options, see
parquet_options()
.
Details
write_parquet()
converts string columns to UTF-8 encoding by calling
base::enc2utf8()
. It does the same for factor levels.