Get the cumulative duplicate count

cumulativeDuplicateCount(x)

Arguments

x

A vector with (potential) duplicates

Value

A vector of length(x) with the cumulative duplicate count

Examples

metabefor::cumulativeDuplicateCount(
  c(1, 1, 2, 3, 4, 2, 5, 6, 2, 7, 8, 1, 2)
);
#>  [1] 1 2 1 1 1 2 1 1 3 1 1 3 4