tests/testthat/test_jaccardIndex.R

expect_identical(ribiosUtils::jaccardIndex(LETTERS[1:5], LETTERS[3:8]),3/8)
expect_identical(ribiosUtils::jaccardIndex(LETTERS[1:2], LETTERS[3:8]),0)
expect_identical(ribiosUtils::jaccardIndex(LETTERS[1:4], LETTERS[1:4]),1)

expect_identical(ribiosUtils::jaccardDistance(LETTERS[1:5], LETTERS[3:8]),5/8)
expect_identical(ribiosUtils::jaccardDistance(LETTERS[1:2], LETTERS[3:8]),1)
expect_identical(ribiosUtils::jaccardDistance(LETTERS[1:4], LETTERS[1:4]),0)

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.