kadane: Contiguous subvector with the largest sum

View source: R/kadane.R

kadaneR Documentation

Contiguous subvector with the largest sum

Description

Finds the contiguous subvector with the largest sum among all the contiguous subvectors of v.

Usage

kadane(v)

Arguments

v

A numeric vector

Details

Taken from https://tomaztsql.wordpress.com/2022/03/28/little-useless-useful-r-functions-kadanes-algorithm/

Value

A one-row data frame with columns

  • Sum - sum of the subvector's elements

  • Start - starting index of the subvector

  • End - ending index of the subvector


pteetor/tutils documentation built on April 25, 2024, 9:14 a.m.