Skip to content

Write to Arrow IPC file (a.k.a Feather file)

Description

Write to Arrow IPC file (a.k.a Feather file)

Usage

<DataFrame>$write_ipc(
  file,
  compression = c("uncompressed", "zstd", "lz4"),
  ...,
  compat_level = TRUE
)

Arguments

file File path to which the result should be written.
compression NULL or a character of the compression method, “uncompressed” or "lz4" or "zstd". NULL is equivalent to “uncompressed”. Choose "zstd" for good compression performance. Choose "lz4" for fast compression/decompression.
Ignored.
compat_level Use a specific compatibility level when exporting Polars’ internal data structures. This can be:
  • an integer indicating the compatibility version (currently only 0 for oldest and 1 for newest);
  • a logical value with TRUE for the newest version and FALSE for the oldest version.

Value

Invisibly returns the input DataFrame.

See Also

  • \$to_raw_ipc()

Examples

library("polars")

dat = as_polars_df(mtcars)

destination = tempfile(fileext = ".arrow")
dat$write_ipc(destination)

if (require("arrow", quietly = TRUE)) {
  arrow::read_ipc_file(destination, as_data_frame = FALSE)
}
#> Table
#> 32 rows x 11 columns
#> $mpg <double>
#> $cyl <double>
#> $disp <double>
#> $hp <double>
#> $drat <double>
#> $wt <double>
#> $qsec <double>
#> $vs <double>
#> $am <double>
#> $gear <double>
#> $carb <double>