dupl_items: Get duplicated items from a vector

dupl_itemsR Documentation

Get duplicated items from a vector

Description

This function takes a numeric or character vector and returns a vector of the unique elements that appear more than once - so a simple shortcut for unique(x[duplicated(x)]) that is particularly friendly in pipes

Usage

dupl_items(x)

Arguments

x

A numeric or character vector from which to identify duplicate elements.

Value

A vector containing unique elements that are duplicated in the original vector. Returns an empty vector if there are no duplicates.

Examples

dupl_items(c(1, 2, 3, 3, 4, 5, 5, 5))
# Output: 3 5
dupl_items(c(1, 2, 3, 4))
# Output: numeric(0)


LukasWallrich/timesaveR documentation built on Nov. 29, 2024, 4:47 a.m.