pos_first_unique: Extract the first position of each unique element in a vector

View source: R/positions.R

pos_first_uniqueR Documentation

Extract the first position of each unique element in a vector

Description

This function extracts the position of the first appearance of each unique element in a vector. This is a simple wrapper for which and duplicated designed to improve code readability and reduce code length.

Usage

pos_first_unique(x)

Arguments

x

A vector.

Value

An integer vector of the positions in a vector at which each unique element appears for the first time.

Author(s)

Edward Lavender

Examples

pos_first_unique(c(1, 1, 1, 2, 4, 1, 2, 4, 9, 10, 1, 2))


edwardlavender/utils.add documentation built on Dec. 14, 2024, 8:11 a.m.