toPositiveIndices: Negative Indices to Positive Indices

View source: R/convert.R

toPositiveIndicesR Documentation

Negative Indices to Positive Indices

Description

Convert negative indices to positive indices where negative indices are interpreted as indices counting from the back of the vector

Usage

toPositiveIndices(indices, n)

Arguments

indices

vector of integer indices

n

maximum index. The index -1 is mapped to n, the index -2 to n - 1, etc.


KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.