Learn R Programming

descriptr (version 0.6.1)

ds_rindex: Index Values

Description

Returns the original positions of values in a vector.

Usage

ds_rindex(data, values)

Value

Original positions of the values in data. Missing values are ignored, and all matching positions are returned. In case data does not contain a value, NULL is returned.

Arguments

data

a numeric vector

values

a numeric vector containing the values whose index is returned

Details

Positions refer to the vector passed in; missing values are not removed before the indices are computed.

Examples

Run this code
# returns index of 21
ds_rindex(mtcars$mpg, 21)

# returns NULL
ds_rindex(mtcars$mpg, 22)

Run the code above in your browser using DataLab