tests/test_mmatch.R

library(ribiosUtils)

test <- mmatch(c("A", "B", "C", "T", "B", "S", "Z", NA, "C", NULL),
               c("A", "B","C","D", "A", "D", "B", "C", "C", "A"))
test2 <-  mmatch(c("A", "B", "C", "T", "B", "S", "Z", NA, "C", NULL),
                 c("A", "B","C","D", "A", "D", "B", "C", "C", "A"),
                 nomatch=0)

torSource <- sample(letters, 20000, replace=TRUE)
torTarget <- sample(letters, 20000, replace=TRUE)
system.time(torMatch <- match(torSource, torTarget))
system.time(torMultiMatch <- mmatch(torSource, torTarget))

namedSources <- c(a="txt", b="csv", c="pdf")
nmm <- mmatch(namedSources, c("csv", "pdf", "pdf", "txt", NA))
## all(sapply(1:20000, function(x) identical(unique(torTarget[torMultiMatch[[x]]]), torSource[[x]])))

Try the ribiosUtils package in your browser

Any scripts or data that you put into this service are public.

ribiosUtils documentation built on March 13, 2020, 2:54 a.m.