Learn R Programming

tsgc (version 0.0)

argmax: Return index and value of maximum

Description

Something similar to Python's argmax.

Usage

argmax(x, decreasing = TRUE)

Value

The maximum value and its index.

Arguments

x

Object to have its maximum found

decreasing

Logical value indicating whether x should be ordered in decreasing order. Default is TRUE. Setting this to FALSE would find the minimum.

Examples

Run this code
library(tsgc)
data(gauteng,package="tsgc")
argmax(gauteng)

Run the code above in your browser using DataLab