recur_unique: Recursively uniquify a list of vectors from left (top) to...

View source: R/recur_unique.R

recur_uniqueR Documentation

Recursively uniquify a list of vectors from left (top) to right (bottom)

Description

Ensure each successive list element is a distinct set relative to all previous elements

Usage

recur_unique(lst, curr.iter = 0L, out = list())

Arguments

lst

A list, typically of length > 1 with elements comprising atomic vectors

curr.iter

Not used; internal counter

out

Not used; result accumulator

Details

There is no type checking for list elements, so standard coercion rules apply, and this may result in unexpected results. You should ensure that types are homogeneous.

Value

A list of identical length to the input, with element lengths equal to or shorter than each initial element length, depending on the degree of overlap and/or if any duplication was present within each element.

Examples

lst <- list(
  v1 = 1:10L,
  v2 = 1:12L,
  v3 = 1:13L
)
recur_unique(lst)

slin30/wzMisc documentation built on Jan. 27, 2023, 1 a.m.