View source: R/write-parquet.R
write_parquet | R Documentation |
Writes the contents of an R data frame into a Parquet file.
write_parquet(
x,
file,
schema = NULL,
compression = c("snappy", "gzip", "zstd", "uncompressed"),
encoding = NULL,
metadata = NULL,
row_groups = NULL,
options = parquet_options()
)
x |
Data frame to write. |
file |
Path to the output file. If this is the string |
schema |
Parquet schema. Specify a schema to tweak the default
nanoparquet R -> Parquet type mappings. Use |
compression |
Compression algorithm to use. Currently |
encoding |
Encoding to use. Possible values:
If If a specified encoding is invalid for a certain column type,
or nanoparquet does not implement it, Currently
See parquet-encodings for more about encodings. |
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 |
row_groups |
Row groups of the Parquet file. If |
options |
Nanoparquet options, see |
write_parquet()
converts string columns to UTF-8 encoding by calling
base::enc2utf8()
. It does the same for factor levels.
NULL
, unless file
is ":raw:"
, in which case the Parquet
file is returned as a raw vector.
read_parquet_metadata()
, read_parquet()
.
# add row names as a column, because `write_parquet()` ignores them.
mtcars2 <- cbind(name = rownames(mtcars), mtcars)
write_parquet(mtcars2, "mtcars.parquet")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.