test_that("Pearson distance - distanceBetween", {
expect_equal(distanceBetween(c(7,4), c(6,6), "pea"), (((7-6)^2)/6)+(((4-6)^2)/6), tolerance=1e-6)
expect_equal(distanceBetween(c(7,4), c(8,1), "pea"), (((7-8)^2)/8)+(((4-1)^2)/1), tolerance=1e-6)
expect_equal(distanceBetween(c(7,4), c(1,5), "pea"), (((7-1)^2)/1)+(((4-5)^2)/5), tolerance=1e-6)
expect_equal(distanceBetween(c(7,4), c(10,2), "pea"), (((7-10)^2)/10)+(((4-2)^2)/2), tolerance=1e-6)
expect_equal(distanceBetween(c(6,6), c(8,1), "pea"), (((6-8)^2)/8)+(((6-1)^2)/1), tolerance=1e-6)
expect_equal(distanceBetween(c(6,6), c(1,5), "pea"), (((6-1)^2)/1)+(((6-5)^2)/5), tolerance=1e-6)
expect_equal(distanceBetween(c(6,6), c(10,2), "pea"), (((6-10)^2)/10)+(((6-2)^2)/2), tolerance=1e-6)
expect_equal(distanceBetween(c(8,1), c(1,5), "pea"), (((8-1)^2)/1)+(((1-5)^2)/5), tolerance=1e-6)
expect_equal(distanceBetween(c(8,1), c(10,2), "pea"), (((8-10)^2)/10)+(((1-2)^2)/2), tolerance=1e-6)
expect_equal(distanceBetween(c(1,5), c(10,2), "pea"), (((1-10)^2)/10)+(((5-2)^2)/2), tolerance=1e-6)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.