Skip to content

Get the first n rows

Description

This is an alias for $head().

Usage

<Expr>$limit(n = 10)

Arguments

n Number of rows to return.

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(a = 1:9)
df$select(pl$col("a")$limit(3))
#> shape: (3, 1)
#> ┌─────┐
#> │ a   │
#> │ --- │
#> │ i32 │
#> ╞═════╡
#> │ 1   │
#> │ 2   │
#> │ 3   │
#> └─────┘