Skip to content

Take the mean of all values horizontally across columns.

Source code

Description

Take the mean of all values horizontally across columns.

Usage

<DataFrame>$mean_horizontal(..., ignore_nulls = TRUE)

Arguments

These dots are for future extensions and must be empty.
ignore_nulls Ignore null values (default). If FALSE, any null value in the input will lead to a null output.

Value

A polars Series

Examples

library("polars")

df <- pl$DataFrame(
  foo = c(1, 2, 3),
  bar = c(4.0, 5.0, 6.0),
)
df$mean_horizontal()
#> shape: (3, 1)
#> ┌──────┐
#> │ mean │
#> │ ---  │
#> │ f64  │
#> ╞══════╡
#> │ 2.5  │
#> │ 3.5  │
#> │ 4.5  │
#> └──────┘