index_for_recode: Determine Indices for Recoding

View source: R/recode.R

index_for_recodeR Documentation

Determine Indices for Recoding

Description

index_for_recode() identifies the positions of elements in x that match any of the values specified in the from vector. This function is primarily used to facilitate the recoding of values by pinpointing which elements in x correspond to the from values and thus need to be replaced or updated.

Usage

index_for_recode(x, from)

Arguments

x

A vector of values in which to search for matches.

from

A vector of values to match against the elements in x.

Value

An integer vector of the same length as x, containing the indices of the matched values from the from vector. If an element in x does not match any value in from, the corresponding position in the output will be NA. This index information is critical for subsequent recoding operations.


sdtm.oak documentation built on April 3, 2025, 9:37 p.m.