SUU: Sort Unlist Unique

Description Usage Arguments Examples

View source: R/ShortFunctions.R

Description

Get the unique set, convert it from list to vector, and then sort it

Usage

1
SUU(thing)

Arguments

thing

thing to get a sorted, unlisted vector of. This is often a column of a data.table.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
X = sample(x = letters[1:20], size = 30, replace = T, prob = (1:20)/sum(1:20))
Y = sample(x = letters[1:20], size = 30, replace = T, prob = (1:20)/sum(1:20))
Z = sample(x = letters[1:20], size = 30, replace = T, prob = (1:20)/sum(1:20))
thing1 = data.table(X = X, Y = Y, Z = Z, stringsAsFactors = F)
thing2 = thing1[,2,with = F]
thing3 = SUU(thing2)
print(thing3)
str(thing3)
SUU(thing1[,1,with = F])
SUU(thing1[,3,with = F])

debarros/dbTools documentation built on Sept. 18, 2020, 10:51 a.m.