Skip to content

Convert an Expr to R output

Source code

Description

This is mostly useful to debug an expression. It evaluates the Expr in an empty DataFrame and return the first Series to R.

Usage

<Expr>$to_r(
  df = NULL,
  i = 0,
  ...,
  int64_conversion = polars_options()\$int64_conversion
)

Arguments

df If NULL (default), it evaluates the Expr in an empty DataFrame. Otherwise, provide a DataFrame that the Expr should be evaluated in.
i Numeric column to extract. Default is zero (which gives the first column).
Any args pased to as.data.frame().
int64_conversion How should Int64 values be handled when converting a polars object to R?
  • “double” (default) converts the integer values to double.
  • “bit64” uses bit64::as.integer64() to do the conversion (requires the package bit64 to be attached).
  • “string” converts Int64 values to character.

Value

R object

Examples

library(polars)

pl$lit(1:3)$to_r()
#> [1] 1 2 3