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"),
  ...,
  future = FALSE
)

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.
future Setting this to TRUE will write Polars’ internal data structures that might not be available by other Arrow implementations. This functionality is considered unstable. It may be changed at any point without it being considered a breaking change.

Value

Invisibly returns the input DataFrame.

See Also

  • \$to_raw_ipc()

Examples

library(polars)

dat = pl$DataFrame(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>