Skip to content

Get the first n elements

Source code

Description

Get the first n elements

Usage

<Expr>$head(n = 10)

Arguments

n Number of elements to take.

Value

Expr

Examples

library(polars)

pl$DataFrame(x = 1:11)$select(pl$col("x")$head(3))
#> shape: (3, 1)
#> ┌─────┐
#> │ x   │
#> │ --- │
#> │ i32 │
#> ╞═════╡
#> │ 1   │
#> │ 2   │
#> │ 3   │
#> └─────┘