uniqueBidirection: uniqueBidirection

View source: R/unique.r

uniqueBidirectionR Documentation

uniqueBidirection

Description

Find unique rows of a data.frame regardless of the order they appear

Usage

uniqueBidirection(x)

Arguments

x

a data.frame

Details

Sorts individual rows to get uniques regardless of order of appearance.

Value

A data.frame that is unique regardless of direction

Author(s)

Jared P. Lander

Examples


ex <- data.frame(One=c('a', 'c', 'a', 'd', 'd', 'c', 'b'), 
Two=c('b', 'd', 'b', 'e', 'c', 'd', 'a'),
stringsAsFactors=FALSE)

# make a bigger version
exBig <- ex
for(i in 1:1000)
{
    exBig <- rbind(exBig, ex)
}

dim(exBig)

uniqueBidirection(ex)
uniqueBidirection(exBig)

ex3 <- dplyr::bind_cols(ex, tibble::tibble(Three=rep('a', nrow(ex))))
uniqueBidirection(ex3)


jaredlander/useful documentation built on Nov. 4, 2023, 10:56 a.m.