Skip to content

Return the element at the given row/column.

Source code

Description

If row and column location are not specified, the DataFrame must have dimensions (1, 1).

Usage

<DataFrame>$item(row = NULL, column = NULL)

Arguments

row Optional row index (0-indexed).
column Optional column index (0-indexed) or name.

Value

A value of length 1

Examples

library(polars)

df = pl$DataFrame(a = c(1, 2, 3), b = c(4, 5, 6))

df$select((pl$col("a") * pl$col("b"))$sum())$item()
#> [1] 32
df$item(1, 1)
#> [1] 5
df$item(2, "b")
#> [1] 6