Skip to content

Sum all values horizontally across columns.

Description

Sum all values horizontally across columns.

Usage

<DataFrame>$sum_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$sum_horizontal()
#> shape: (3,)
#> Series: 'sum' [f64]
#> [
#>  5.0
#>  7.0
#>  9.0
#> ]