rowSumOf

@JvmName(name = "rowSumOfShort")
inline fun <reified T : Short> DataRow<*>.rowSumOf(_kClass: KClass<Short> = Short::class): Int

Returns the sum of the Short values in this DataRow, as an Int.

Only the values in the columns of type Short (or Short?) are taken into account; all other columns of the row are ignored.

Columns inside column groups are also excluded. To include those in the sum, flatten the DataFrame first.

All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (BigInteger, BigDecimal) are not supported; convert them to a primitive number type first.

null values in the input are always ignored.

The result is never null and has the same type as the input, except for Byte and Short, which sum to Int, and "mixed" Number input, which sums to the common type of its values.

For more information about the resulting types: See "sum Type Conversion" on the documentation website.

When there is nothing to sum, for instance, when the input is empty or contains only null values, the result is 0 in the result type

See also:

  • rowSum — the sum of all the numbers in this row, of any number type.

  • sum — the sum of the values in specific columns of a DataFrame.

  • The Sum Operation — an overview of all sum modes.

For more information: See "Row statistics" on the documentation website.

Example

// The sum of all `Short` values in the first row, as an `Int`
df[0].rowSumOf<Short>()

Return

The sum of the Short values in this row, as an Int.

Parameters

_kClass

Technical parameter to distinguish this overload from the others; you never need to supply it.

Type Parameters

T

The type of the values to sum. Only columns of this type are taken into account.


@JvmName(name = "rowSumOfByte")
inline fun <reified T : Byte> DataRow<*>.rowSumOf(_kClass: KClass<Byte> = Byte::class): Int

Returns the sum of the Byte values in this DataRow, as an Int.

Only the values in the columns of type Byte (or Byte?) are taken into account; all other columns of the row are ignored.

Columns inside column groups are also excluded. To include those in the sum, flatten the DataFrame first.

All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (BigInteger, BigDecimal) are not supported; convert them to a primitive number type first.

null values in the input are always ignored.

The result is never null and has the same type as the input, except for Byte and Short, which sum to Int, and "mixed" Number input, which sums to the common type of its values.

For more information about the resulting types: See "sum Type Conversion" on the documentation website.

When there is nothing to sum, for instance, when the input is empty or contains only null values, the result is 0 in the result type

See also:

  • rowSum — the sum of all the numbers in this row, of any number type.

  • sum — the sum of the values in specific columns of a DataFrame.

  • The Sum Operation — an overview of all sum modes.

For more information: See "Row statistics" on the documentation website.

Example

// The sum of all `Byte` values in the first row, as an `Int`
df[0].rowSumOf<Byte>()

Return

The sum of the Byte values in this row, as an Int.

Parameters

_kClass

Technical parameter to distinguish this overload from the others; you never need to supply it.

Type Parameters

T

The type of the values to sum. Only columns of this type are taken into account.


@JvmName(name = "rowSumOfInt")
inline fun <reified T : Int> DataRow<*>.rowSumOf(_kClass: KClass<Int> = Int::class): Int

Returns the sum of the Int values in this DataRow.

Only the values in the columns of type Int (or Int?) are taken into account; all other columns of the row are ignored.

Columns inside column groups are also excluded. To include those in the sum, flatten the DataFrame first.

All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (BigInteger, BigDecimal) are not supported; convert them to a primitive number type first.

null values in the input are always ignored.

The result is never null and has the same type as the input, except for Byte and Short, which sum to Int, and "mixed" Number input, which sums to the common type of its values.

For more information about the resulting types: See "sum Type Conversion" on the documentation website.

When there is nothing to sum, for instance, when the input is empty or contains only null values, the result is 0 in the result type

See also:

  • rowSum — the sum of all the numbers in this row, of any number type.

  • sum — the sum of the values in specific columns of a DataFrame.

  • The Sum Operation — an overview of all sum modes.

For more information: See "Row statistics" on the documentation website.

Example

// The sum of all `Int` values ("age" and "weight") in the first row
df[0].rowSumOf<Int>()

Return

The sum of the Int values in this row.

Parameters

_kClass

Technical parameter to distinguish this overload from the others; you never need to supply it.

Type Parameters

T

The type of the values to sum. Only columns of this type are taken into account.


@JvmName(name = "rowSumOfLong")
inline fun <reified T : Long> DataRow<*>.rowSumOf(_kClass: KClass<Long> = Long::class): Long

Returns the sum of the Long values in this DataRow.

Only the values in the columns of type Long (or Long?) are taken into account; all other columns of the row are ignored.

Columns inside column groups are also excluded. To include those in the sum, flatten the DataFrame first.

All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (BigInteger, BigDecimal) are not supported; convert them to a primitive number type first.

null values in the input are always ignored.

The result is never null and has the same type as the input, except for Byte and Short, which sum to Int, and "mixed" Number input, which sums to the common type of its values.

For more information about the resulting types: See "sum Type Conversion" on the documentation website.

When there is nothing to sum, for instance, when the input is empty or contains only null values, the result is 0 in the result type

See also:

  • rowSum — the sum of all the numbers in this row, of any number type.

  • sum — the sum of the values in specific columns of a DataFrame.

  • The Sum Operation — an overview of all sum modes.

For more information: See "Row statistics" on the documentation website.

Example

// The sum of all `Long` values in the first row
df[0].rowSumOf<Long>()

Return

The sum of the Long values in this row.

Parameters

_kClass

Technical parameter to distinguish this overload from the others; you never need to supply it.

Type Parameters

T

The type of the values to sum. Only columns of this type are taken into account.


@JvmName(name = "rowSumOfFloat")
inline fun <reified T : Float> DataRow<*>.rowSumOf(skipNaN: Boolean = skipNaNDefault, _kClass: KClass<Float> = Float::class): Float

Returns the sum of the Float values in this DataRow.

Only the values in the columns of type Float (or Float?) are taken into account; all other columns of the row are ignored.

Columns inside column groups are also excluded. To include those in the sum, flatten the DataFrame first.

All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (BigInteger, BigDecimal) are not supported; convert them to a primitive number type first.

null values in the input are always ignored.

If the input contains NaN values, the result will be NaN, unless skipNaN is set to true.

The result is never null and has the same type as the input, except for Byte and Short, which sum to Int, and "mixed" Number input, which sums to the common type of its values.

For more information about the resulting types: See "sum Type Conversion" on the documentation website.

When there is nothing to sum, for instance, when the input is empty or contains only null values, the result is 0 in the result type

See also:

  • rowSum — the sum of all the numbers in this row, of any number type.

  • sum — the sum of the values in specific columns of a DataFrame.

  • The Sum Operation — an overview of all sum modes.

For more information: See "Row statistics" on the documentation website.

Example

// The sum of all `Float` values in the first row, ignoring `NaN` values
df[0].rowSumOf<Float>(skipNaN = true)

Return

The sum of the Float values in this row.

Parameters

_kClass

Technical parameter to distinguish this overload from the others; you never need to supply it.

skipNaN

If true, NaN values are ignored, just like null values. If false (the default), a NaN in the input is propagated to the result. This only has an effect on Double and Float values.

Type Parameters

T

The type of the values to sum. Only columns of this type are taken into account.


@JvmName(name = "rowSumOfDouble")
inline fun <reified T : Double> DataRow<*>.rowSumOf(skipNaN: Boolean = skipNaNDefault, _kClass: KClass<Double> = Double::class): Double

Returns the sum of the Double values in this DataRow.

Only the values in the columns of type Double (or Double?) are taken into account; all other columns of the row are ignored.

Columns inside column groups are also excluded. To include those in the sum, flatten the DataFrame first.

All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (BigInteger, BigDecimal) are not supported; convert them to a primitive number type first.

null values in the input are always ignored.

If the input contains NaN values, the result will be NaN, unless skipNaN is set to true.

The result is never null and has the same type as the input, except for Byte and Short, which sum to Int, and "mixed" Number input, which sums to the common type of its values.

For more information about the resulting types: See "sum Type Conversion" on the documentation website.

When there is nothing to sum, for instance, when the input is empty or contains only null values, the result is 0 in the result type

See also:

  • rowSum — the sum of all the numbers in this row, of any number type.

  • sum — the sum of the values in specific columns of a DataFrame.

  • The Sum Operation — an overview of all sum modes.

For more information: See "Row statistics" on the documentation website.

Example

// The sum of all `Double` values in the first row, ignoring `NaN` values
df[0].rowSumOf<Double>(skipNaN = true)

Return

The sum of the Double values in this row.

Parameters

_kClass

Technical parameter to distinguish this overload from the others; you never need to supply it.

skipNaN

If true, NaN values are ignored, just like null values. If false (the default), a NaN in the input is propagated to the result. This only has an effect on Double and Float values.

Type Parameters

T

The type of the values to sum. Only columns of this type are taken into account.


fun DataRow<*>.rowSumOf(type: KType, skipNaN: Boolean = skipNaNDefault): Number

Returns the sum of the values of the given type in this DataRow.

Only the values in the columns of the given type (or its nullable variant) are taken into account; all other columns of the row are ignored.

Columns inside column groups are also excluded. To include those in the sum, flatten the DataFrame first.

This overload takes the type as a KType argument; prefer the reified overloads, like rowSumOf<Int>(), whenever the type is known at compile time.

All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (BigInteger, BigDecimal) are not supported; convert them to a primitive number type first.

null values in the input are always ignored.

If the input contains NaN values, the result will be NaN, unless skipNaN is set to true.

The result is never null and has the same type as the input, except for Byte and Short, which sum to Int, and "mixed" Number input, which sums to the common type of its values.

For more information about the resulting types: See "sum Type Conversion" on the documentation website.

When there is nothing to sum, for instance, when the input is empty or contains only null values, the result is 0 in the result type

See also:

  • rowSum — the sum of all the numbers in this row, of any number type.

  • sum — the sum of the values in specific columns of a DataFrame.

  • The Sum Operation — an overview of all sum modes.

For more information: See "Row statistics" on the documentation website.

Example

// The sum of all `Int` values ("age" and "weight") in the first row
df[0].rowSumOf(typeOf<Int>())

Return

The sum of the values of the given type in this row.

Parameters

type

The type of the values to sum. Only columns of this type are taken into account.

skipNaN

If true, NaN values are ignored, just like null values. If false (the default), a NaN in the input is propagated to the result. This only has an effect on Double and Float values.

Throws

if type is not a primitive number type or Number itself.