Skip to content

Get a slice of the LazyFrame.

Description

Get a slice of the LazyFrame.

Usage

<LazyFrame>$slice(offset, length = NULL)

Arguments

offset Start index. Negative indexing is supported.
length Length of the slice. If NULL (default), all rows starting at the offset will be selected.

Value

A polars LazyFrame

Examples

library("polars")

lf <- pl$LazyFrame(x = c("a", "b", "c"), y = 1:3, z = 4:6)
lf$slice(1, 2)$collect()
#> shape: (2, 3)
#> ┌─────┬─────┬─────┐
#> │ x   ┆ y   ┆ z   │
#> │ --- ┆ --- ┆ --- │
#> │ str ┆ i32 ┆ i32 │
#> ╞═════╪═════╪═════╡
#> │ b   ┆ 2   ┆ 5   │
#> │ c   ┆ 3   ┆ 6   │
#> └─────┴─────┴─────┘