which.duplicate: Count duplicate values in a vector

View source: R/skUtils.R

which.duplicateR Documentation

Count duplicate values in a vector

Description

which.duplicate() determines for each element of a vector how many times its value has occurred so far.

Usage

which.duplicate(x)

Arguments

x

A vector.

Details

It works similarly to [base::duplicated()] which only determines whether a value has occurred before and not how many times.

Value

A vector of the same length as x, where each element represents the number of times the value in the same position in x has been repeated so far.

Author(s)

Sercan Kahveci

Examples

which.duplicate(c(1,6,5,2,1,1,8,6,5))


Spiritspeak/skMisc documentation built on April 12, 2025, 5:40 a.m.