sortAscii {geecc}R Documentation

Optimized operations of sets of character-vectors

Description

Sort and use pre-sorted character vectors in set-operations

Usage

sortAscii(x)
intersectPresort(pop, x)
setdiffPresort(pop, x)

Arguments

x

an unsorted vectors of strings

pop

a sorted vector of strings

Details

By default, sorting is done lexicographically in R. The routine sortAscii does sorting accoring to the ASCII-order as done in C/C++.

For routines intersectPresort and setdiffPresort the first argument has to be sorted according to ASCII-order. This first argument is expected to be large compared to the second argument. Both functions are wrappers for optimized C++-functions performing the set-operation.

Value

An character-vector. In case of intersectPresort and setdiffPresort, these vectors are unnamed.

Examples

AA <- matrix( sample( c(LETTERS, letters), 10*30000, rep=TRUE ), ncol=10 )
A <- unique(apply(AA, 1, paste, collapse=""))
B <- sample(AA, 100, replace=FALSE); B <- c(B, "1234")

res <- intersectPresort( sortAscii(A), B )

[Package geecc version 1.18.0 Index]