rray_min_pos: Locate the position of the minimum value

Description Usage Arguments Value Examples

View source: R/min-pos.R

Description

rray_min_pos() returns the integer position of the minimum value over an axis.

Usage

1

Arguments

x

A vector, matrix, array, or rray.

axis

A single integer specifying the axis to compute along. 1 computes along rows, reducing the number of rows to 1. 2 does the same, but along columns, and so on for higher dimensions. The default of NULL first flattens x to 1-D.

Value

An integer object of the same type and shape as x, except along axis, which has been reduced to size 1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- rray(c(1:10, 20:11), dim = c(5, 2, 2))

# Flatten x, then find the position of the max value
rray_min_pos(x)

# Compute along the rows
rray_min_pos(x, 1)

# Compute along the columns
rray_min_pos(x, 2)

rray documentation built on July 23, 2019, 5:04 p.m.